Skip to main content

GridBagLayout tab order problem

4 replies [Last post]
fanny983
Offline
Joined: 2010-03-14

Hi, I have a problem with GridBagLayout tab order (or tab index). I used this layout to create, for example, a 2x2 grid. I would like to setting the tab order top to bottom but the default setting of this layout set this left to right.

How can I do for force this default setting?

Thank you!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fanny983
Offline
Joined: 2010-03-14

thanks

Message was edited by: fanny983

rturnbull
Offline
Joined: 2005-08-27

See the java tutorial on the focus subsystem
http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html

specifically, the section on Customising Focus Traversal

Afterthought - you may be able to control it by adding the
components in the order you want the focus to go.
But I'm not sure about that

Message was edited by: rturnbull

fanny983
Offline
Joined: 2010-03-14

> Afterthought - you may be able to control it by
> adding the
> components in the order you want the focus to go.
> ut I'm not sure about that

I already added the components in order but do not get the desired result. So, reading the link http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html I think: is very complex force the default tab order? There is not a simpler solution? :(

fanny983
Offline
Joined: 2010-03-14

Ok I solved! everything worked perfectly with FocusTraversalPolicy use!
Thank you rturnbull!!!