Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4710506

Text is still pre-comitted after pressing enter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs



      Name: dk106046 Date: 07/02/2002

      Java (TM) 2 Runtime Environment Standard Edition (build 1.4.0_01-b03)

      Using Chinese(Traditional) input method, composition text seems to be committed by hitting Enter key before commit it. But it is not committed as it appears to be. The highlight has just been removed. If you then type a second character, the cursor jumps back up a line, and highlights both characters.

      1. Copy following code and save it as JTextA.java.

      /*
       * JTextA.java
       */
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      public class JTextA extends JFrame {
             Component c;
             public JTextA() {
                    super("Single Frame --- Swing JFrame");
                    
                    // set layout here.
                    getContentPane().setLayout(new GridLayout(0, 1));

                    
                    // add components here.
                    c = new JTextArea("JTextArea component");
                    MyKeyListener keyListener = new MyKeyListener();
                    c.addKeyListener(keyListener);
                    getContentPane().add(c);

                    
                    addWindowListener(new WindowAdapter() {
                           public void windowClosing(WindowEvent event) {
                                  System.exit(0);
                           }
                    });
                    setSize(300, 300);
                    show();
             }
             
             public static void main(String[] args) {
                    new JTextA();
             }
      }
      class MyKeyListener extends KeyAdapter {
             public void keyPressed(KeyEvent event) {
                    int code = event.getKeyCode();
                    String name = event.getComponent().getClass().getName();
                    System.out.println("KeyPressed => [" + event.getKeyText(code) + "] (" + code + ") on " + name);
             }
             public void keyTyped(KeyEvent event) {
                    char c = event.getKeyChar();
                    String name = event.getComponent().getClass().getName();
                    System.out.println("KeyTyped => " + c + " (0x" + Integer.toHexString(c) + ") on " + name);
             }
             public void keyReleased(KeyEvent event) {
                    ;
             }
      }


      2. Compile JTextA.java and run the JTextA.
         #java JTextA
         => Single Frame ---Swing JFrame window will come up.

      3. Activate Chinese(Traditional) - Array input method.

      4. Type [A] key.
        => Capital-A appears at insert position(Over the Spot style), and it is highlighted and underlined
            to show the "A" is composition text.
            Convertion candidate window appears.

      5. Hit Enter key.
        => Cursor moves to next line. The capital-A seems to be commited. <--- PROBLEM
           Convertion candidate window remains (it is active).

      Expected result:
      It should not appear to be commited at step-5.

      ======================================================================

            naoto Naoto Sato
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: