Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to add focus to a cell in a JTable

 
Padma Prasad
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How can I add focus to a cell in a JTable? When I add a row in a table, I want the focus to go to the first cell in the row. When I say table.requestFocus(), the first cell of first row is getting the focus. but i want for the newly created row. How can i do this?

Thanks,
Anand.
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could try setRowSelectionInterval(newRowIndex, newRowIndex)

D.
 
Padma Prasad
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah. When I did this, I am getting the whole row selected. But I want the focus in the first column of the row so that the user can input before he clicks on it. Rather, I want the cursor in the cell and not that the whole row getting highlighted. When I add the row, the first cell should be ready for input. I am using windows look and feel.

Thanks,
Anand.

[ November 09, 2004: Message edited by: Angel Anand ]
[ November 09, 2004: Message edited by: Angel Anand ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic