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

JDK1.4.0b38, JMenu fails under Solaris 8 (Sparc)

XMLWordPrintable

    • x86
    • generic



      Name: jbT81659 Date: 10/29/2000

      JDK1.4.0-B38, JMenu fails to execute under Solaris Sparc 8.
      The following error is displayed at time of execution.

      ===================
      isam@tiger 509: java jMenu
      Menu item [????? ????] was pressed.
      Menu item [? ? ?] was pressed.
      Menu item [? ? ?] was pressed.
      # # An unexpected exception has been detected in native code
      outside the VM.# Program counter=0xf5e2ea80
      #
      # Problematic Thread: prio=5 tid=0x20a4a8 nid=0xc runnable
      #
      ===================

      Here is the code for jMenu.java
      ------------------

      /* Copyright (c) Sun Microsystems 1998

      $Header: /home/sun/src/JDK1.2/jMenu.java,v 1.13 2000/03/30 08:13:08 isam Exp $

      */

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class jMenu extends JApplet
      {
      public void init()
      {
      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
      frame.setJMenuBar(new jMenuX());
      frame.pack();
      frame.setVisible(true);
      }
      public static void main(String[] argv)
      {
      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
      frame.setJMenuBar(new jMenuX());
      frame.pack();
      frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

      }

      }
      class jMenuX extends JMenuBar implements ActionListener
      {

      String[] fileItems = new String[]
      {
      "\u062c\u062f\u064a\u062f\u0020\u05d7\u05d3\u05e9",
      "\u0641\u062a\u062d\u0020\u0645\u0644\u0641",
      "\u062d\u0641\u0638\u0020",
      "\u05d9\u05e6\u05d9\u05d0\u05d4\u0020\u062e\u0631\u0648\u062c"
      };

      String[] editItems = new String[]
      {
      "\u05d4\u05e2\u05ea\u05e7\u0020\u0625\u0646\u0633\u062e",
      "\u05d7\u05ea\u05d5\u05da\u0020\u0625\u0642\u0637\u0639",
      "\u05ea\u05d5\u05e1\u05d9\u05e3\u0020\u0623\u0636\u0641",
      "\u0623\u0644\u0635\u0642\u0020\u05ea\u05e2\u05e1\u05d4"
      };
      char[] fileShortcuts = { 'a','z','q','w' };
      char[] editShortcuts = { 'x','c','v','k' };

      public jMenuX()
      {
      JMenu fileMenu = new JMenu();
               fileMenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      fileMenu.setText("\u0645\u0644\u0641\u0020\u05e7\u05d5\u05d1\u05e5");
               JMenu editMenu = new JMenu();
               editMenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      editMenu.setText("\u05d0\u05e4\u05e9\u05e8\u05d9\u05d5\u05ea\u0020\u062e\u064a\u0627\u0631\u0627\u062a");
               JMenu otherMenu = new JMenu();
               otherMenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      otherMenu.setText("\u05d0\u05d7\u05e8\u0020\u0627\u062e\u0631");
               JMenu subMenu = new JMenu();
               subMenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      subMenu.setText("\u05ea\u05e4\u05e8\u05d9\u05d8\u0020\u0642\u0627\u0626\u0645\u0629");
               JMenu subMenu2 = new JMenu();
               subMenu2.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      subMenu2.setText("\u05ea\u05e4\u05e8\u05d9\u05d8\u0020\u05d7\u05d3\u05e9\u0020\u0642\u0627\u0626\u0645\u0629\u0020\u062c\u062f\u064a\u062f\u0629");

      for (int i=0; i < fileItems.length; i++)
      {
                   JMenuItem item = new JMenuItem(fileItems[i], fileShortcuts[i]);
               item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
                   item.addActionListener(this);
                   fileMenu.add(item);
               }

               for (int i=0; i < editItems.length; i++)
      {
                   JMenuItem item = new JMenuItem(editItems[i]);
               item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
                   item.setAccelerator(KeyStroke.getKeyStroke(editShortcuts[i],
                       java.awt.Event.CTRL_MASK, false));
                   item.addActionListener(this);
                   editMenu.add(item);
               }
               editMenu.insertSeparator(1);
      JMenuItem item = new JMenuItem();;
               item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      item = new JMenuItem("\u0623\u0646\u0642\u0631\u0020\u05ea\u05dc\u05d7\u05e5");
               subMenu2.add(item);
               item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      item.setText("\u0631\u0627\u062f\u064a\u0648\u0020\u05e8\u05d3\u05d9\u05d5");
               item.addActionListener(this);
               subMenu.add(item);
               item.addActionListener(this);
               subMenu.add(subMenu2);
               otherMenu.add(subMenu);
      item.setText("\u0623\u0646\u0642\u0631\u0020\u05ea\u05dc\u05d7\u05e5");
               otherMenu.add(item);
               item.addActionListener(this);
               otherMenu.addSeparator();
               ButtonGroup buttonGroup = new ButtonGroup();
      item = new JRadioButtonMenuItem();
      item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      item.setText("\u0631\u0627\u062f\u064a\u0648\u0020\u05e8\u05d3\u05d9\u05d5");
               otherMenu.add(item);

               item.addActionListener(this);
               buttonGroup.add(item);
               otherMenu.add(item);
      item = new JRadioButtonMenuItem();
      item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      item.setText("\u0631\u0627\u062f\u064a\u0648\u0020\u05e8\u05d3\u05d9\u05d5");
               item.addActionListener(this);
               buttonGroup.add(item);
               otherMenu.addSeparator();
               otherMenu.add(item);
      item.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      item.setText("\u0661\u0020\u0662\u0020\u0663");
               item.addActionListener(this);
               add(fileMenu);
               add(editMenu);
               add(otherMenu);
           }
           public void actionPerformed(ActionEvent event)
      {
               System.out.println("Menu item [" + event.getActionCommand() + "] was pressed.");
           }

      }
      ------------------

      WorkAround:
      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: