Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Set Focus Order

  Asked By: Kuhaylah    Date: Mar 25    Category: Java    Views: 1431

I am working on a form with several text fields and input
components. When I try to tab to the next field in the form the
focus switches in a weird order. How do I set the form so when tab
is pressed the form goes to the next field from left to right and top
to bottom? The only way I see to do it now is to do a FocusListener
for each input component. This seems ridiculous and a lot of work
for such a simple feature. I am thinking there must be an easier way.



1 Answer Found

Answer #1    Answered By: Edwin Chavez     Answered On: Mar 25

I figured it out.
It depends on the order  the elements are added to the panel. The
function setNextFocusableCOmponent(Component) is useful as well.

Didn't find what you were looking for? Find more on Set Focus Order Or get search suggestion and latest updates.