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

[macos] InputMethod's committed text does not pass to passive component

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 11, 14
    • Fix Version/s: tbd
    • Component/s: client-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      openjdk version "14-ea" 2020-03-17
      OpenJDK Runtime Environment (build 14-ea+23-1048)
      OpenJDK 64-Bit Server VM (build 14-ea+23-1048, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OSX

      A DESCRIPTION OF THE PROBLEM :
      When InputMethod for east Asian countries are used in passive component,
      such as JButton, committed text doesn't pass to it.

      Additionally, input characters before committing passed to the component unexpectedly.

      Active component (JTextArea, JTextField, and so on) could receive committed text correctly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The following is Japanese case. This problem is also recreated in Chinese and Taiwanese.

      1. Compile and launch the sample code with Japanese InputMethod enabled OS.
      2. Switch to Japanese Input mode
      3. Type "aa", then type space key several times.
      4. Type Enter key to commit the converted text

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      Only selected Japanese text passed to the component.
      Actual:
      Typed "aa" and space characters passed to the component.
      No selected Japanese text passed.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      JButtonWithKeyTyped.java
      -----
      import java.awt.event.*;
      import javax.swing.*;

      public class JButtonWithKeyTyped extends JButton implements KeyListener {
        StringBuilder sb = new StringBuilder();

        JButtonWithKeyTyped() {
          addKeyListener(this);
        }
        public void keyTyped(KeyEvent ke) {
          char c = ke.getKeyChar();
          if (!Character.isISOControl(c)) {
            sb.append(c);
            setText(sb.toString());
          }
        }
        public void keyPressed(KeyEvent ke) {}
        public void keyReleased(KeyEvent ke) {}

        public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.getContentPane().add(new JButtonWithKeyTyped());
          frame.setSize(300,200);
          frame.setVisible(true);
        }
      }
      ---------- END SOURCE ---------- 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tnakamura Toshio Nakamura
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: