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?
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
posted 12 years ago
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.