This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
Urgent Help Needed:KeyPress Down Listener on a Complex JTable created by CellRenderer
posted 9 years ago
Hi, 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!! Thanks,