How to use "Ctrl+Tab" key to switch between JInternalFrames

From: Freeman Ding (fengdingcn_at_yahoo.com)
Date: 02/29/04


Date: 28 Feb 2004 22:20:47 -0800

How to use "Ctrl+Tab" key to switch between JInternalFrames ?

In the project I am currently working in, five JInternalFrames
instances are added to a JDesktopPane instance. There are quite a few
GUI components such as panels, buttons in each JInternalFrame.

I want to implement two features:
1. Press "Tab" key to traverse focus between the GUI components within
a JInternalFrame.
2. Press "Ctrl+Tab" to traverse focus between the five
JInternalFrames.

I found that no any special coding needed for the first feature. It
seems that AWT/Swing could implement it, and this is the default
behaviour.

But since by default "Ctrl+Tab" also traverse focus between GUI
components within a JInternalFrame, I think that the second feature
does need my coding work.

I am not familiar with AWT/Swing key board and focus APIs, so I am
confused by many "solutions" such as Key Bindings, Key Listener, Focus
Listener, LayoutFocusTraversalPolicy etc. Is there any easy fix for
the second feature?

I am using JDK 1.3.1 on Windows 2000. Thanks a lot in advance.

--Freeman


Quantcast