Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accepting text in JTable

 
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
 
Itapaj� Takeguma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Surya Kumar:
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


You could see of Component. I don't have this problem because when the user wants to change a value, he presses a button and a update frame is openned.

Itapaj�.
 
Norm Poole
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

table.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
table.getCellEditor().cancelCellEditing();
}

});
 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Itapaje

I don't have this problem because when the user wants to change a value, he presses a button and a update frame is openned.

As you mean, a new frame which ask user for enter update record info will occurs,won't it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic