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

JSpinner auto selection doesn't work for Japanese

XMLWordPrintable

    • Fix Understood
    • x86
    • linux



      Name: dk106046 Date: 08/16/2004

      OPERATING SYSTEM(S):
      RHEL3.0/IA32

      FULL JDK VERSION(S):
      java version "1.4.2_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
      Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)


      Japanese locale and Japanese input method(Canna and kinput2) is required.

      1. Build JSpinner.java testcase:

      import java.util.*;
      import java.awt.*;
      import javax.swing.*;
      import java.text.*;
      public class JSpinnerTest extends JFrame {
          JSpinner spinner;
          
          public JSpinnerTest(String[] texts) {
              super("JSpinnerTest");
              Container c = getContentPane();
              c.setLayout(new GridLayout(4, 2));
              
              // SpinnerListModel
              c.add(new JLabel("SpinnerListModel: "));
              ArrayList list = new ArrayList();
              for (int i = 0; i < texts.length; ++i) {
                  list.add(texts[i]);
              }
              spinner = new JSpinner(new SpinnerListModel(list));
              c.add(spinner);
              
              // SpinnerListModel - Weekdays
              c.add(new JLabel("SpinnerListModel - Weekdays: "));
              String[] days = new DateFormatSymbols().getWeekdays();
              spinner = new JSpinner(new SpinnerListModel(days));
              c.add(spinner);
              
              // SpinnerDateModel
              c.add(new JLabel("SpinnerDateModel: "));
              spinner = new JSpinner(new SpinnerDateModel());
              c.add(spinner);
              
              // SpinnerNumberModel
              //spinner = new JSpinner(new SpinnerNumberModel(500.0, 0.0, 1000.0, 0.625));
              //c.add(spinner);
              
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              setSize(400, 150);
              show();
          }
          
          public static void main(String[] args) {
              if (args.length < 1) {
                  System.err.println("usage: java JSpinnerTest str0 str1 str2 ...");
                  System.exit(1);
              }
              new JSpinnerTest(args);
          }
      }

      2. Run JSpinnerTest.

         java JSpinnerTest test

      3. Set input focus to "SpinnerListModel-Weekdays" field.

      4. Enable Japanese IM by Shift + Space.

      5. Input "hi", then hit space key twice.

         Then candidate selection window appears.

         When the following character is selected, an item in JSpinner appears.
         This is the correct behavior because there is an selection item(a name of day of week)
         which starts with this character(Sunday) exists in the JSpinner.

      ********
      * *
      * *
      ********
      * *
      * *
      ********

      6. Then hit space key several times to select the following character.
         (If the following character is selected first, select the character above in this step)

          *
      * * *
       * * *
          *
          *
         * *
        * *
      ** **

         Then the selected item in JSpinner doesn't change. <- PROBLEM

         This should show another item in JSpinner which starts with this character(Tuesday).

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

            peterz Peter Zhelezniakov
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: