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 JTabbedPane Focus problem: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTabbedPane Focus problem:" Watch "JTabbedPane Focus problem:" New topic

JTabbedPane Focus problem:

Sudha Yadav

Joined: Jun 09, 2004
Posts: 1
I'm working on a GUI application which copntains 6 tabbed pane.
i've to wite a focus traversal policy so that on pressing on the
successive tabs (ctrl+tab) the focus moves on each tab.
i've witten a focus traversal policy for this purpose and calling it in my main GUI
creation method.

main gui code snippet as folows:

Component compPanel1 = makePanel1();
Component compPanel2 = makePanel2();

jTabbedPane1.addTab("Panel l", compUser);
jTabbedPane1.addTab("Panel l", compRole);

and when a tab is selected focus moved to a specified button in that pane.

so where should i put up policy class and how can i call in my class.
KR Campbell
Ranch Hand

Joined: Mar 26, 2004
Posts: 124

You should be able to treat the tabbed pane as the focus cycle root of your traversal.

Alternatively, you could set the default policy from the KeyboardFocusManager before creating your components. You would still need to make sure that the tabbed pane is a focus cycle root. I can't remember exactly, but from what you describe you may find that the existing default policy will provide the traversal behaviour you require anyway.

I agree. Here's the link:
subject: JTabbedPane Focus problem:
It's not a secret anymore!