Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accepting text in JTable  RSS feed

 
Surya Kumar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Jtable and a set of Jbuttons. Whats happening is when the user enters some value in the Jtable and clicks on these buttons the new value is not yet applied to the model calsses hence not taken into consideration. If i press the enter key or tab out of that field then it was taken.

Is there any way so that a cell value is applied to the model even if a button is pressed. Regards
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try updating the JTable model before collecting its data.
Both AbstractTableModel and DefaultTableModel have appealing options such as

which is inherited from AbstractTableModel by DefaultTableModel, and
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!