United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6882912 Strange behaviours when typing @ or '
JDK-6882912 : Strange behaviours when typing @ or '

Details
Type:
Bug
Submit Date:
2009-09-17
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2010-02-16
Component:
client-libs
OS:
windows_vista,generic,windows_xp
Sub-Component:
javax.swing
CPU:
x86,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b71)
Java HotSpot(TM) Client VM (build 16.0-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 6.0.6002]

A DESCRIPTION OF THE PROBLEM :
Typing a @ in a JTextArea when running over JRE7 delete the following character. Typing a ' first move the cursor to the next character then insert '

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the following code with JRE7b71 then insert a few blank lines (say 3 times) then type 'test', then type @  on the first line, set the cursor between the e and s of test then type '

import java.awt.Dimension;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
public class Main {
    public static void main(String[] args) {
      JTextArea jta = new JTextArea();
      jta.setPreferredSize(new Dimension(200, 200));
      JOptionPane.showMessageDialog(null, jta);
    }
}


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The content of the JTextArea should be:
@


te'st
ACTUAL -
The content of the JTextArea is:
@

tes't

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
public class Main {
    public static void main(String[] args) {
      JTextArea jta = new JTextArea();
      jta.setPreferredSize(new Dimension(200, 200));
      JOptionPane.showMessageDialog(null, jta);
    }
}

---------- END SOURCE ----------

Release Regression From : 6u13
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

                                    

Comments
EVALUATION

I reproduced even more strange problem:

 - type anything in the textfield in the provided testcase
 - return the caret to the very beginning
 - type " several times 
 - you'll see that the " symbol overrides the previously typed text

This behavior is not specific to the textArea inside the JOptionPane,
please refer to the follwing test case:

import javax.swing.*;

public class Main {
    public static void main(String[] args) {
        JTextArea jta = new JTextArea();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(jta);
        frame.setSize(200, 200);
        frame.setVisible(true);
    }
}

accepted and upgraded
                                     
2009-10-01
EVALUATION

Problem is due to a stray line in the ExtendedKeyCodes.java. There should be some cleanup in this table.
                                     
2010-02-08



Hardware and Software, Engineered to Work Together