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 JTable and JButton - Focus issue 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 "JTable and JButton - Focus issue" Watch "JTable and JButton - Focus issue" New topic
Author

JTable and JButton - Focus issue

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
I have a simple GUI.
I have a JTable with some rows and columns.
I have a JButton.
Default JTable behaviour is that -
if you press "TAB" in the last cell, the cursor goes to the first cell.
But what I need is, if you press "TAB" in the last cell, the focus should go out of JTable and select the JButton.

How to achieve this?
Digen Mahara
Greenhorn

Joined: Dec 23, 2011
Posts: 23

Okay Darryl is Correct : Ctrl + Tab is a good Alternative

Sorry Darryl I'll try to make my posts more meaningfull


To every Tunnel there is always a way out
So keep Trying...
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Digen Mahara wrote:You can use the nextFocusable() method i m not sure about the method's spelling but there is surely something if you are using an IDE search for such method

You can find it in JFrame class

Digen, have you ever heard of the Java API? Have you ever read the API for JFrame?


luck, db
There are no new questions, but there may be new answers.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Gurumurthy Ramamurthy wrote:I have a simple GUI.
I have a JTable with some rows and columns.
I have a JButton.
Default JTable behaviour is that -
if you press "TAB" in the last cell, the cursor goes to the first cell.
But what I need is, if you press "TAB" in the last cell, the focus should go out of JTable and select the JButton.

How to achieve this?

Press Ctrl-Tab to tab out of the table.

This is standard and expected GUI behavior, not just in Java but in all visual platforms.
Digen Mahara
Greenhorn

Joined: Dec 23, 2011
Posts: 23

Darryl Burke wrote:
Digen Mahara wrote:You can use the nextFocusable() method i m not sure about the method's spelling but there is surely something if you are using an IDE search for such method

You can find it in JFrame class

Digen, have you ever heard of the Java API? Have you ever read the API for JFrame?


I was not sure as I mentioned, this was because I was a Former NetBeans user but later turned to Eclipse
and I think I saw it somewhere in properties window in NetBeans but I think I was Wrong and will see to it that I post proper suggesstions or codes
and try to help and understand more.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTable and JButton - Focus issue
 
Similar Threads
Issues with JTextArea as cellEditor of JTable Column.
Tab order problem with JTextField, JTable, JButton...help please(URGENT)...
JTable focus issue
JTable
JTable