File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable Cell and Tab Problem[jdk1.3  ] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable Cell and Tab Problem[jdk1.3  ]" Watch "JTable Cell and Tab Problem[jdk1.3  ]" New topic

JTable Cell and Tab Problem[jdk1.3 ]

vinaya kumar
Ranch Hand

Joined: Jan 20, 2002
Posts: 70
Hello All,
I want to transfer focus to next component from a table with one column, i add one value to row
then i press tab.
I expected the focus to shift to next component,
but nothing happened, the cell got selected and then when i pressed tab again, row got selected
and then now for the third time i pressed tab
the focus shifts to the next component.
is this problem with jdk1.3.1_01 , how to fix this.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
What is happening is the default behavior for a JTable. I think this will solve your problem but I'm not totally sure.
There is a method with the following signature which is inherited from JComponent:
public boolean isFocusTraversable()
This usually returns false but is overridden in JTable to return true.
I would try subclassing JTable and overriding the above method and have it return false and see if that works.
Good lucl

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
vinaya kumar
Ranch Hand

Joined: Jan 20, 2002
Posts: 70
Thanks Michael,
Problems sounds to be have fixed.
Now i finding one more problem,
my next component is a panel in which is one more table, so now my focus should be on Row 0,column 0.
Should there be a focus listener on the table,which on getting focus says editCell(0,0)
I agree. Here's the link:
subject: JTable Cell and Tab Problem[jdk1.3 ]
It's not a secret anymore!