JDK-6927815 : REGRESSION: Problems inserting single and double quotes in JTextfield
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-02-18
  • Updated: 2011-01-19
  • Resolved: 2010-02-19
Related Reports
Duplicate :  
Description
OPERATING SYSTEM
----------------
Windows XP

FULL JDK VERSION
----------------
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b80)
Java HotSpot(TM) Client VM (build 17.0-b07, mixed mode)

Problem was introduced in either b55, b56 or b57. (Not reproducible with b54, but reproducible with b57 - I haven't been able to test the builds in between)

STEPS TO REPRODUCE
------------------

1. Compile and run the attached testcase.
2. Position the cursor somewhere between the beginning and end of the
   word "Input" in the text field.
3. Try to insert a single quote <'>. Observe that the quote is inserted
   in the wrong position - one character ahead of where you would expect
   it to appear.
4. Try to insert a double quotes character <">. Observe that the
   character is not inserted - instead it replaces the character to the
   right of the cursor.

Note that on UK keyboards, where the <"> and <@> character's position's are swapped compared to US keyboards, the problem described in step 4 occurs when trying to insert the <@> character. In other words, the problem is tied to the *key* rather than the character.

TESTCASE SOURCE
---------------
=======================================================================
import java.awt.*;
import javax.swing.*;

public class TextField extends JFrame {
  JTextField Input;
  Container Panel;
  LayoutManager Layout;

  public TextField() {
    Input = new JTextField("Input", 20);
    Layout = new FlowLayout();
    Panel = getContentPane();
    Panel.setLayout (Layout);
    Panel.add (Input);
  }

  public static void main(String[] args) {
      TextField theTextField = new TextField();
      theTextField.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      theTextField.setSize(300, 100);
      theTextField.show();
  }
}
=======================================================================

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