Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable is losing selection

 
Marek Puchalski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marek Puchalski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic