• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTabbedPane - traversing focus through tabs

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to have focus traverse through tabs in a JTabbedPane. That is, when the focus is on the last component of a tab, hitting the key for forward focus traverse should bring up the next tab and focus on the first component on that tab. I'm already using a custom FocusTraversalPolicy on the panel containing the JTabbedPane, which handles focus traversal between the components on the tabs. This policy has no knowledge of which tab a particular component is on.

I was hoping calling requestFocusInWindow() would automagically focus that tab, but it doesn't. Needless to say, having the focus traversal policy cycle through all the components (including those in non-selected tabs) doesn't work, either. Is there an elegant way to do this, without resorting to listening to key events, watching for the TAB key, and switching to the appropriate tab?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of JDK and Windows you are using? There is bug with JDK 1.4.1 with XP on traversing in JTabbedPane. Check this out. Not sure you are hitting this bug.
All The Best.
 
Juan Antonio Ramirez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, JDK 1.6, Windows XP.

The issue is not Ctrl+Tab not working, but rather an extension to the normal Tab keyboard focus system, where I want focus traversing into the next tab in a JTabbedPane after the last component in a particular tab. Call it an implicit Ctrl+Tab when hitting Tab when the last component in a tab is focused.
 
reply
    Bookmark Topic Watch Topic
  • New Topic