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

Focus lost after using "Select Input Method" menu

    XMLWordPrintable

    Details

    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: dk106046 Date: 07/09/2002

      Turbo Linux 7.0 in a ja_JP locale

      1.4.1-rc-b16


      ------------

      1. Run IMUtil to set up the IM selection key to be Shift F4

      /*
       * IMUtil.java
       * stores the input method selection key definition.
       */
      import java.util.prefs.*;
      import java.awt.event.*;
      public class IMUtil {
          public static void main(String[] args) {
              if (args.length == 0) {
                  System.err.println("Storing IM Selection Key...");
                  IMSelectKeySetter.setIMSelectionKey();
                  IMSelectKeySetter.getIMSelectionKey();
              } else {
                  if (args[0].equals("-r")) {
                      System.err.println("Removing IM Selection Key...");
                      IMSelectKeySetter.removeIMSelectionKey();
                  } else if (args[0].equals("-q")) {
                      System.err.println("Retrieving IM Selection Key...");
                      IMSelectKeySetter.getIMSelectionKey();
                  } else {
                      System.err.println("Unknown parameter: " + args[0]);
                      System.err.println("usage: java IMUtil [-r | -q]");
                  }
              }
          }
      }


      class IMSelectKeySetter {
          static final int INPUT_METHOD_SELECTION_KEY = java.awt.event.KeyEvent.VK_F4;
          static final int INPUT_METHOD_SELECTION_KEY_MODIFIERS = java.awt.event.InputEvent.SHIFT_MASK;
          private static String ourNodeName = "/java/awt/im/selectionKey";
          private static String selectionKey = "keyCode";
          private static String selectionKeyModifiers = "modifiers";
          
          static void setIMSelectionKey() {
              Preferences prefs = Preferences.userRoot().node(ourNodeName);
              
              prefs.putInt(selectionKey, INPUT_METHOD_SELECTION_KEY);
              prefs.putInt(selectionKeyModifiers, INPUT_METHOD_SELECTION_KEY_MODIFIERS);
          }
          
          static void removeIMSelectionKey() {
              Preferences prefs = Preferences.userRoot().node(ourNodeName);
              
              prefs.remove(selectionKey);
              prefs.remove(selectionKeyModifiers);
          }
          
          static void getIMSelectionKey() {
              Preferences prefs = Preferences.userRoot().node(ourNodeName);
              
              int keyCode = prefs.getInt(selectionKey, 0);
              int modifiers = prefs.getInt(selectionKeyModifiers, 0);
      // System.out.println("Input Method Selection Key : " + keyCode);
      // System.out.println("Input Method Selection Key Modifiers: " + modifiers);
              System.out.println("Input Method Selection Key : " + KeyEvent.getKeyText(keyCode) + " (" + keyCode + ")");
              System.out.println("Input Method Selection Key Modifiers: " + KeyEvent.getKeyModifiersText(modifiers) + " (" + modifiers + ")");
          }
      }


      2. Then start up SwingSet2 demo but be sure to have at least one console window visible as well on the desktop.

      3. On the Internal Frames Demo, click into the Frame title text field to get focus there.

      4. Press Shift F4 to invoke IM menu.

      5. Select the City IM and the first language in its list.
      The menu closes down and it is not obvious where focus is (Don't click the mouse)

      Now the problem is that when you type, the chars go to wherever the mouse is positioned over.
      You can move mouse over console window and see chars typed in there.
      Position mouse pointer over any part of the SwingSet demo & the chars go into the text field.

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

        Attachments

          Activity

            People

            Assignee:
            ant Anton Tarasov
            Reporter:
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: