Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Focus issues with JCheckBoxes in a JTable



I have a JTable that has a column with Boolean values. This column is set to be editable and I use the default cell editor which is a JCheckBox. I find that after clicking a checkbox, my menu shortcuts no longer work until I click elsewhere to move the focus away from the checkbox. Note that this only happens if I set the JTable as a whole to be non-focusable (so I don't get selection rectangles when I click in a cell).

I have one work around where in the tableChanged() notification I set the focus back to the main window. However there is a timing issue where I need to delay transferring the focus using invokeLater in order to get it to work. There is also an issue in that I need to do this only if the change is the result of a click (i.e. it is non- programmatic). This requires me to set some flags before and after the programmatic changes. Overall, this solution seems a bit messy and I'm wondering if others have encountered it and found a better way.

I haven't tried this on Windows yet to see if this is a Mac only issue.
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.