• Post Reply Bookmark Topic Watch Topic
  • New Topic

now the real question  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to catch JTable's VK_TAB event. I do it fine with KeyListener, but I also need to know on which row/column tab was keyed so that I can get the value of the cell. What's the best way to do it? I know how to accomplish this with MouseListener -- table.rowAtPoint(me.getPoint());, but this is good only for MouseListener. What about KeyListener?
thanks,
Alex
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if i understand what you need, but on the keyPressed Event utilize :
int row = getSelectedRow() then use this "row" variable.
Best Regards
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex,if your table is a JTable, I think that you may be interested by ListSelectionListener. You should create a class that implements ListSelectionListener and provide a body for the method public void valueChanged(ListSelectionEvent e).
This listener is notified each time that your JTable selection is changed.
Hope it helps
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!