Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent Help Needed:KeyPress Down Listener on a Complex JTable created by CellRenderer  RSS feed

Vinod Menghani
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable that is made with Components created by cellRenderers. Each cell is a Component object returned by the getTableCellRendererComponent() method. Each Component returned by getTableCellRendererComponent() is a customized object which has a JTable inside it. Now I have to listen to the events on the inside table (table within the Component of each cell) when the user moves from one cell to another by pressing the key down. I have the listener on this inside table which listens to the keyevent. This works fine. My problem starts when the user is in the last row of that table. Key press down by the user should take him to the first row of the inside table of the next cell of outside table.
What I have done is if the user is at the last row of the inside table and if there is next row of the outside table, I get the Component of the outside table cell by calling getTableCellEditorComponent() and then get the inside table of that Component. Now, I am not able to get the focus to the first row of the inside table. My cursor gets lost. I have also called requestFocus on that inside table and used setSelectionAt(0,0) and editCellAt(0,0) of that inside table, but nothing works. Please help!!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!