aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTabbedPane Focus problem:" Watch "JTabbedPane Focus problem:" New topic
Author

JTabbedPane Focus problem:

Sudha Yadav
Greenhorn

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);
jTabbedPane1.setSelectedIndex(0);

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
Hi,

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.

Regards,
Ken
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTabbedPane Focus problem: