• Post Reply Bookmark Topic Watch Topic
  • New Topic

Selecting all data in a cell using the tab key

 
Nicki Guy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable with editable cells. When I click on each cell with the mouse the text is highlighted so that when the user starts typing the existing text is overwriten. I have done this by using focuslistener and selectall() method when focusgained. However this doesn't seem to work if I use the tab key or the up down arrow keys to move to the next cell. Can anyone help me with this?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the code to do that on my laptop. I will try to get that for you sometime today (unless someone else posts first).
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one way to do it:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!