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

title of Tear-Off menu shows garbage when the label is japanese

XMLWordPrintable

    • sparc
    • solaris_2.5.1, solaris_9

      [katakai 4/8/97 JST]
      The title of Tear-Off menu shows garbage when the label is japanese.
      I tested on S2.5.1 CDE enviroment.
       
      Please try to run following program and set the menu to Tear-Off.
      The title should display japanese text of "\u30d5\u30a1\u30a4\u30eb",
      but shows garbage.
       
      import java.awt.*;
       
      public class sample {
              public static void main( String[] args ) {
                      Frame f=new Frame();
                      Menu fileMenu = new Menu("\u30d5\u30a1\u30a4\u30eb",true);
                      fileMenu.add(new MenuItem("\u958b\u304f..."));
                      MenuBar menuBar = new MenuBar();
                      menuBar.add(fileMenu);
                      f.setMenuBar(menuBar);
                      f.setSize(200,200);
                      f.show();
              }
      }
      ===========================================================================

      Name: diC59631 1997-09-30

      Another licensee reports the same problem

      In JDK1.2L almost AWT peer can display japanese characters.
      But only MenuItem cannot display Japanese charcters even in JDK1.2M.

      My test program is followed.

      -----HTML-----
      <applet code="ShowEUCJIS.class" width="500" height="500">
      </applet>
      -----Java-----
      /**
       *
       * Unicode \u8868\u793a\u30c6\u30b9\u30c8(EUCJIS)
       * @(#)ShowEUCJIS.java 1.1 (97/09/24)
       *
       *
       * @version @(#)ShowEUCJIS.java 1.1 97/09/24
       * @author Toshiki Murata
       *
       * Copyright (C) 1996 Oki Electric Industry Co.,Ltd.
       */

      import java.applet.Applet;
      import java.awt.*;

      public class ShowEUCJIS extends Applet {

          public void init() {
              Component parent = this;
              while (parent != null && !(parent instanceof Frame)) {
                  parent = parent.getParent();
              }
              if (parent != null) {
                  MenuBar menubar = ((Frame)parent).getMenuBar();
                  if (menubar != null) {
                      Menu menu1, menu2, menu3 ;
                      menu1 = new Menu("Menu");
                      menu1.add(new MenuItem("Close"));
                      menu2 = new Menu("Kanji(EUCJIS) --> \u6f22\u5b57");
                      menu2.add(new MenuItem("Kanji(EUCJIS) --> \u6f22\u5b57"));
                      menu3 = new Menu("Sub Kanji(EUCJIS) --> \u6f22\u5b57");
                      menu3.add(new MenuItem("Kanji(EUCJIS) --> \u6f22\u5b57"));
                      menu2.add(menu3);
                      menubar.add(menu1);
                      menubar.add(menu2);
                  }
              }

              // \u6f22\u5b57(\ub4c1\ubbfa in EUCJIS)
              add(new Label("Kanji(EUCJIS) --> \u6f22\u5b57")) ;
              add(new TextArea("Kanji(EUCJIS) --> \u6f22\u5b57"));
              //TextArea textArea;
              //add(textArea = new TextArea());
              //textArea.setText("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(new TextField("Kanji(EUCJIS) --> \u6f22\u5b57"));
              add(new Button("Kanji(EUCJIS) --> \u6f22\u5b57"));
              add(new Checkbox("Kanji(EUCJIS) --> \u6f22\u5b57"));

              List list;
              list = new List();
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(list);

              Choice chooser = new Choice();
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(chooser);

              Frame frame = new ShowEUCJISFrame(this);
          }

          public static void main(String[] args) {
              Frame frame = new Frame();
              frame.resize(500,500);
              ShowEUCJIS showEUCJIS = new ShowEUCJIS();
              frame.add(showEUCJIS);
              frame.show();
              showEUCJIS.init();
              showEUCJIS.start();
          }
      }

      class ShowEUCJISFrame extends Frame {
          Applet applet;
          ShowEUCJISFrame(Applet applet) {
              super("Kanji(EUCJIS) --> \u6f22\u5b57");

              this.applet = applet;

              setLayout(new FlowLayout());

              Menu menu1, menu2, menu3 ;
              menu1 = new Menu("Menu");
              menu1.add(new MenuItem("Close"));
              menu2 = new Menu("Kanji(EUCJIS) --> \u6f22\u5b57");
              menu2.add(new MenuItem("Kanji(EUCJIS) --> \u6f22\u5b57"));
              menu3 = new Menu("Sub Kanji(EUCJIS) --> \u6f22\u5b57");
              menu3.add(new MenuItem("Kanji(EUCJIS) --> \u6f22\u5b57"));
              menu2.add(menu3);
              MenuBar mbar = new MenuBar();
              mbar.add(menu1);
              mbar.add(menu2);
              setMenuBar(mbar);

              // \u6f22\u5b57(\ub4c1\ubbfa in EUCJIS)
              add(new Label("Kanji(EUCJIS) --> \u6f22\u5b57")) ;
              add(new TextArea("Kanji(EUCJIS) --> \u6f22\u5b57"));
              //TextArea textArea;
              //add(textArea = new TextArea());
              //textArea.setText("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(new TextField("Kanji(EUCJIS) --> \u6f22\u5b57"));
              add(new Button("Kanji(EUCJIS) --> \u6f22\u5b57"));
              add(new Checkbox("Kanji(EUCJIS) --> \u6f22\u5b57"));

              List list;
              list = new List();
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              list.addItem("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(list);

              Choice chooser = new Choice();
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              chooser.add("Kanji(EUCJIS) --> \u6f22\u5b57");
              add(chooser);

              resize(500, 500);
              show();

          }

          // \u30a2\u30af\u30b7\u30e7\u30f3\u30a4\u30d9\u30f3\u30c8
          public boolean action(Event e, Object o) {

              // \u30e1\u30cb\u30e5\u30fc\u51e6\u7406
              if (e.target instanceof MenuItem) {
                  String s = (String)o;
                  if (s.equals("Close")) {
                      dispose();
                      applet.showStatus("Kanji(EUCJIS) --> \u6f22\u5b57");
                  }
                  return true;
              }
              return false;
          }

          // \u30cf\u30f3\u30c9\u30eb\u30a4\u30d9\u30f3\u30c8
          public boolean handleEvent(Event e) {
              if (e.id == Event.WINDOW_DESTROY) {
                  // delete, close\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u30
      89\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u9589\u3058\u308b
                  dispose();
                  return true;
              }

              // return false; \u3067\u306f\u306a\u304f\u3001
              // \u3053\u3046\u3057\u306a\u3044\u3068\u30a2\u30af\u30b7\u30e7\u30f3\u3
      0a4\u30d9\u30f3\u30c8(action(e,o))\u304c\u547c\u3070\u308c\u306a\u3044
              return super.handleEvent(e);
          }
      }

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

            dmendenhsunw David Mendenhall (Inactive)
            katakai Masaki Katakai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: