Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTabbedPane Focus problem:

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic