Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ctrl-TAB moves focus from JTextArea even tho focus traversal keys disabled

929204Aug 22 2012 — edited Aug 24 2012
Hello everyone,

I hope someone can help me with this problem because I've tried everything I can think of, I've scoured Google, I'm exhausted and still completely stumped.
I have a JTextArea, for which I've called setFocusTraversalKeysEnabled(false). I've even done the following, though I don't think it's necessary:
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
When I put the text area in a window (JFrame), the expected happens - Ctrl-TAB doesn't move the focus.
HOWEVER, when I put two of these JTextAreas in a JSplitPane, Ctrl-TAB jumps the focus to a JTextField at the bottom of the window (outside of the JSplitPane)!
I've confirmed with various calls to getFocusTraversalKeysEnabled() that the traversal keys are indeed disabled (and remaining disabled).
Calling setFocusTraversalKeysEnabled(false) for the JSplitPane doesn't change anything...

If I catch Ctrl-TAB in a key listener registered on the JTextAreas and consume the event, the focus doesn't move. That is one solution I suppose, but I'm really bugged by the fact that for some reason setFocusTraversalKeysEnabled(false) isn't working.
Does anyone have any ideas why this could be happening?
THANKS!
This post has been answered by aterai on Aug 24 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2012
Added on Aug 22 2012
4 comments
579 views