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

TextComponent ignores enableInputMethods() setting

    XMLWordPrintable

Details

    Description

      Peer component such as TextField's enableInputMethods does not work properly,
      which means they don't work as described in apidoc.

      ---- java.awt.Component API doc ----

      - enableInputMethods

      public void enableInputMethods(boolean enable)

           Enables or disables input method support or this component. If input method
           support is enabled, incoming events are offered to the current input method and
           will only be processed by the component or dispatched to its listeners if the
           input method does not consume them. By default, input method support is
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           disabled.
           ^^^^^^^^^

           Parameters:
               enable - true to enable, false to disable.

      --- end of java.awt.Component API doc ---


      According to apidoc, following tf1 and tf2 are non-client and tf3 is
      passive client.

      ---
      TextField tf1 = new TextField();// supposed to be non-client
      TextField tf2 = new TextField();
      TextField tf3 = new TextField();

      tf2.enableInputMethods(false); // supposed to be non-client
      tf3.enableInputMethods(true); // supposed to be passive client

      ---

      But the result was different.

      field can use IM preedit style status style NOTE
      ---------------------------------------------------------------------------------------------------------------------------------------------------------
      tf1(WIN32) yes overTheSpot Root(native) passive-client, same behavior as JDK1.1
      tf1(Solaris) yes overTheSpot ImDisplaysInClient(native) passive-client, same behavior as JDK1.1
      tf2(WIN32) no N/A N/A non-client
      tf2(Solaris) yes ovetTheSpot ImDisplaysInClient(native) passive-client, same as tf1(Solaris)
      tf3(WIN32) yes overTheSpot Root(native) passive-client, same as tf1(WIN32)
      tf3(Solaris) yes N/A Root(IMF?) passsive, but client can't get nor display composed text.
      ----------------------------------------------------------------------------------------------------------------------------------------------------------

      tf1 and tf2 should be non-client but they can use IM on Solaris, and
      their behavior is different on Windows.

      tf3 should be passive-client but it does not work on Solaris platform.


      [Test environment]

      WIN32 Japanese Windows95 RevB(OSR2)
      Solaris Japanese Solaris 2.6(CDE)
      JDK: JDK1.2beta2


      ---- sample test program code ----

      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.im.*;
      import java.awt.font.TextHitInfo;
      import java.text.*;

      public class IMFTest2 extends Applet {

          TextField tf1;
          TextField tf2;
          TextField tf3;

          public void init() {
      tf1 = new TextField(20);
      tf2 = new TextField(20);
      tf3 = new TextField(20);

      tf2.enableInputMethods(false);
      tf3.enableInputMethods(true);

      add(tf1);
      add(tf2);
      add(tf3);

          }
          
          public void start() {
          }
          
          public void stop() {
          }

          public static void main(String argv[]) {
              IMFTest2 test = new IMFTest2();
              test.init();
              test.start();
              
              Frame frame = new Frame("Input Method Framework Test2");
              frame.pack(); // adds peer
              frame.add("Center", test);
              frame.setSize(400, 400);
              WindowListener listener = new WindowAdapter() {
                      public void windowClosing(WindowEvent e) {
                          e.getWindow().dispose();
                          System.exit(0);
                      }
                  };
              frame.addWindowListener(listener);
              frame.pack();
              frame.show();

              test.getComponent(0).requestFocus();
          }

      }

      Attachments

        Activity

          People

            sherman Xueming Shen
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: