Name: rmT116609 Date: 05/12/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux MyLaptop 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Every letter, number entered is duplicated when painted in the textfield.
even though i have an evt.consume() the keyevent appears to be passed along to other keyevent listeners. I only listen to keyPressed events.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run example.
type a letter, or so in the textfield.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Only the String in the setText() should be on the screen.
ACTUAL -
the character typed in is duplicated
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* TEXTFIELDbug.java
*
* Created on May 11, 2004, 6:59 PM
*/
/**
*
* @author gat
*/
public class TEXTFIELDbug extends java.awt.Frame {
/** Creates new form TEXTFIELDbug */
public TEXTFIELDbug() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
tf2 = new java.awt.TextField();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
tf2.setColumns(35);
tf2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
tf2KeyPressed(evt);
}
});
add(tf2, java.awt.BorderLayout.CENTER);
pack();
}//GEN-END:initComponents
private void tf2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tf2KeyPressed
// Add your handling code here:
evt.consume();
char c = evt.getKeyChar();
String s = tf2.getText();
s = s + c;
tf2.setText( s );
//int i = tf2.getCaretPosition();
//tf2.setCaretPosition( i++ );
System.out.println( "TEXTFIELDbug.tf2KeyPressed(); setText()=\""+s+"\", getText()=\""+tf2.getText()+"\"");
}//GEN-LAST:event_tf2KeyPressed
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new TEXTFIELDbug().show();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private java.awt.TextField tf2;
// End of variables declaration//GEN-END:variables
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 265185)
======================================================================
|