Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable and JButton - Focus issue

 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay Darryl is Correct : Ctrl + Tab is a good Alternative

Sorry Darryl I'll try to make my posts more meaningfull
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic