Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JTable with JCheckboxes: checkbox shifts left when clicked at

407 views
Skip to first unread message

jame...@my-deja.com

unread,
Aug 16, 2001, 4:10:45 PM8/16/01
to
Hi.
When I depress the mouse button on a checkbox in a JTable, the check
box moves from the center of the cell to the very left of the cell,
and shifts back to the center of the cell when I lift the mouse
button. Does anyone know how to avoid this movement and keep the
checkbox at the center of the cell?
Thx.

Collector

unread,
Aug 16, 2001, 3:06:22 PM8/16/01
to
In the part of your table where you setup the CellEditor, there should be
some sort of JCheckBox variable you used to initialize the editor. Try
putting
<nameOfThisJCheckBoxVariable>.setHorizontalAlignment(JCheckBox.CENTER). By
default, the alignment is set to align left, which is why you are seeing it
move to the left while you are editing it (by clicking) and then return to
the center.

Hope this helps!

<jame...@my-deja.com> wrote in message
news:9275fd7e.01081...@posting.google.com...

jame...@my-deja.com

unread,
Aug 17, 2001, 8:27:35 AM8/17/01
to
Works great! Thx Collector.

"Collector" <coll...@hotmail.com> wrote in message news:<9lhchh$ijs$1...@rcp6.elan.af.mil>...

0 new messages