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