-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The tab key is not ignored in JTextArea although setFocusTraversalKeysEnabled(true) is set.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile coding and press tab several times.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tab on JTextArea is going to the next component, e..g in this example to the button.
ACTUAL -
Tab is excecuted within the JTextArea.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Example:
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class Test extends JFrame {
Test(){
JTextArea ta = new JTextArea("Test");
JButton button = new JButton("Moin");
ta.setFocusTraversalKeysEnabled(true);
getContentPane().add(ta, java.awt.BorderLayout.NORTH);
getContentPane().add(button, java.awt.BorderLayout.CENTER);
}
public static void main (String[] args) {
Test test = new Test();
test.pack();
test.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can catch the key events yourself.
ta.addKeyListener(new KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_TAB)
{
e.consume();
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusNextComponent();
}
if (e.getKeyCode() == KeyEvent.VK_TAB
&& e.isShiftDown())
{
e.consume();
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusPreviousComponent();
}
}
});
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The tab key is not ignored in JTextArea although setFocusTraversalKeysEnabled(true) is set.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile coding and press tab several times.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tab on JTextArea is going to the next component, e..g in this example to the button.
ACTUAL -
Tab is excecuted within the JTextArea.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Example:
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class Test extends JFrame {
Test(){
JTextArea ta = new JTextArea("Test");
JButton button = new JButton("Moin");
ta.setFocusTraversalKeysEnabled(true);
getContentPane().add(ta, java.awt.BorderLayout.NORTH);
getContentPane().add(button, java.awt.BorderLayout.CENTER);
}
public static void main (String[] args) {
Test test = new Test();
test.pack();
test.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can catch the key events yourself.
ta.addKeyListener(new KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_TAB)
{
e.consume();
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusNextComponent();
}
if (e.getKeyCode() == KeyEvent.VK_TAB
&& e.isShiftDown())
{
e.consume();
KeyboardFocusManager.
getCurrentKeyboardFocusManager().focusPreviousComponent();
}
}
});