File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTable is losing selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable is losing selection" Watch "JTable is losing selection" New topic
Author

JTable is losing selection

Marek Puchalski
Greenhorn

Joined: Jul 21, 2005
Posts: 2
In the begining I didn't like the default table cell editor behavior. When the cell editor lost its focus, it was still active. The cell editor was active, it didn't return the value to the table model. This migh confuse the user, so I decided to use:

table.putClientProperty( "terminateEditOnFocusLost",
Boolean.TRUE );

But it still lacks something. When I'm losing the focus the, cell editor is being closed (nice), but I also lose the cell selection (which is a problem, because I have a button near the table which uses the data from the selected cell... the focus goes to the button -> the table loses it's selection -> I don't know which sell to refer to).

I would appreciate any help.

Best regards

Marek


You can't run away. Everyone's connected.
Marek Puchalski
Greenhorn

Joined: Jul 21, 2005
Posts: 2
Ech, it's not exactly as I sad. As I can see now, I can access table.getSelectedRow() from my button action litener. Sorry, my mistake. This problem never existed in the first place.

Best regards

Marek
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTable is losing selection