Setting focus traversal keys for JTextArea

It's unable to use the "Tab" key for JTextArea to focus next swing component. The next code fixes this problem, and makes the Tab and Shift-Tab keys usable to focus forward or backward.
JTextArea textArea = new JTextArea();
textArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,null);
textArea.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,null);

0 comment(s):