This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to set focus on JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to set focus on JTable" Watch "How to set focus on JTable" New topic
Author

How to set focus on JTable

Narayanan Jayaraman
Ranch Hand

Joined: Apr 09, 2003
Posts: 52
After populating and displaying JTable how to set focus or highlight the first row in the table. ?Thanks
Di Shoe
Greenhorn

Joined: Jun 20, 2003
Posts: 7
What you can do is put the table in a ScrollPane, then call:

where the x in setValue(x) is the row # in the table.
I hope this helps.
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
How about...

Hope this helps,
Abhik.
Narayanan Jayaraman
Ranch Hand

Joined: Apr 09, 2003
Posts: 52
Thanks Abhik. It works fine.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to set focus on JTable
 
Similar Threads
JTable column non-focusable?
tabbing in JTable
tabbing in JTable
JTable
JTable