FULL PRODUCT VERSION :
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000
5.00.2195
Service Pack 4
A DESCRIPTION OF THE PROBLEM :
When you traverse from JTextArea to another JTextArea with keyboard(using Ctrl+Tab) , the first character typed in does not show(gets consumed).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Have about of 4-6 JTextAreas on a JFrame(or any container) in any fashion. Now use keyboard(ctrl+tab) to traverse from one JTextArea to the other, type in a word and notice if the entire word shows, now keep repeating this step, you are bound to see that the first character of the word is not typed in.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All printable characters should appear in the JTextArea regardless of how the user entered the field (via mouse clicks or keyboard traversal)
ACTUAL -
First character of the word is consumed without displaying in the field when tabbed into a JTextArea from another JTextArea using the keyboard.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class FrameConsumer extends JFrame {
JTextArea jTextArea1 = new JTextArea();
JTextArea jTextArea2 = new JTextArea();
JTextArea jTextArea3 = new JTextArea();
JTextArea jTextArea4 = new JTextArea();
FlowLayout flowLayout1 = new FlowLayout();
GridLayout gridLayout1 = new GridLayout();
public FrameConsumer() {
setTitle("Consuming Characters");
getContentPane().setLayout(gridLayout1);
jTextArea1.setBorder(BorderFactory.createLoweredBevelBorder());
jTextArea4.setBorder(BorderFactory.createLoweredBevelBorder());
jTextArea3.setBorder(BorderFactory.createLoweredBevelBorder());
jTextArea2.setBorder(BorderFactory.createLoweredBevelBorder());
gridLayout1.setVgap(5);
this.getContentPane().add(jTextArea1, null);
gridLayout1.setColumns(1);
gridLayout1.setRows(4);
this.getContentPane().add(jTextArea2, null);
this.getContentPane().add(jTextArea3, null);
this.getContentPane().add(jTextArea4, null);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
this_windowClosing(e);
}
});
}
public void this_windowClosing(WindowEvent e) {
System.exit(0);
}
public static void main(String[] args) {
FrameConsumer frame = new FrameConsumer();
frame.setSize(400, 400);
frame.show();
}
}
---------- END SOURCE ----------