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

Win2000 Eng,typing character "j" opens menu in applications that contains menus

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: jbT81659 Date: 04/30/2000

      Under Win2000 English, typing the character j in any swing text component
      in an aplication that contains a menu causes the menu to open.
      To reproduce bug:

      Compile and run the following code under windows 2000 english.
      type the letter "j" inside the TextPane
      Note that Menu is opened each time you type that character.
      Type other characters.
      Note that application behaves normally.

      ------------Code---------------
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home/sun/src/JDK1.2/jCheckBoxMenuItem.java,v 1.13 2000/04/25 11:17:18 isam Exp $

      */

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

      public class jCheckBoxMenuItem extends JApplet
      {
        public void init()
        {
                      
              jCheckBoxMenuItem1 example = new jCheckBoxMenuItem1 ();
              example.pane = new JTextPane();
              example.pane.setPreferredSize(new Dimension(250, 250));
              example.pane.setBorder(new BevelBorder(BevelBorder.LOWERED));
              getContentPane().add(example.menuBar, BorderLayout.NORTH);
              getContentPane().add(example.pane, BorderLayout.CENTER);

        }

              public static void main(String[] argv)
              {
                      jCheckBoxMenuItem1 example = new jCheckBoxMenuItem1 ();
                      example.pane = new JTextPane();
                      example.pane.setPreferredSize(new Dimension(250, 250));
                      example.pane.setBorder(new BevelBorder(BevelBorder.RAISED));
                      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
                      frame.getContentPane().add(example.menuBar, BorderLayout.NORTH);
                      frame.getContentPane().add(example.pane, BorderLayout.CENTER);
                      frame.pack();
                      frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

              }
      }

      class jCheckBoxMenuItem1 extends JPanel implements ActionListener
      {
              public JTextPane pane;
              public JMenuBar menuBar;
              public JToolBar toolBar;

              public jCheckBoxMenuItem1()
              {
                      super(true);
              TitledBorder titled;
              titled = BorderFactory.createTitledBorder("\u0645\u062b\u0627\u0644\u0020\u05d3\u05d2\u05de\u05d4");
              titled.setTitleFont( new Font("Lucida Sans Regular", Font.PLAIN,9));
                      menuBar = new JMenuBar();
              menuBar.setBorder(titled);
                      JMenu justifyMenu = new JMenu();
                      justifyMenu.setFont(new Font("Lucida Sans Regular",Font.PLAIN,16));
      justifyMenu.setText("\u0645\u062b\u0627\u0644\u0020\u05d3\u05d2\u05de\u05d4");
                      justifyMenu.setMnemonic('J');

                      JCheckBoxMenuItem leftJustify = new JCheckBoxMenuItem("\u0647\u0630\u0647\u0020\u0633\u0646\u0629\u0020\u0661\u0669\u0665\u0668\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0020\u0031\u0039\u0035\u0038");
              leftJustify.setBorder(titled);
                      leftJustify.setHorizontalTextPosition(JMenuItem.LEFT);
                      leftJustify.setMnemonic('L');
                      leftJustify.setFont(new Font("Lucida Sans Regular",Font.PLAIN,16));
                      leftJustify.addActionListener(this);

                      
                      JCheckBoxMenuItem rightJustify = new JCheckBoxMenuItem("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");
              rightJustify.setBorder(titled);
                      rightJustify.setHorizontalTextPosition(JMenuItem.LEFT);
                      rightJustify.setMnemonic('R');
                      rightJustify.setFont(new Font("Lucida Sans Regular",Font.PLAIN,16));
                      rightJustify.addActionListener(this);

                      JCheckBoxMenuItem centerJustify = new JCheckBoxMenuItem("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
              centerJustify.setBorder(titled);
                      centerJustify.setHorizontalTextPosition(JMenuItem.LEFT);
                      centerJustify.setMnemonic('C');
                      centerJustify.addActionListener(this);
                      centerJustify.setFont(new Font("Lucida Sans Regular",Font.PLAIN,16));

                      justifyMenu.add(leftJustify);
                      justifyMenu.add(rightJustify);
                      justifyMenu.add(centerJustify);

                      menuBar.add(justifyMenu);
                      Font sammy = new Font("Lucida Sans Regular", Font.PLAIN, 8);
              }
              public void actionPerformed(ActionEvent e)
              {
                      try
                      {
                          pane.getStyledDocument().insertString(0 , "Action ["+e.getActionCommand()+"] performed!\n", null);
                      }
                      catch (Exception ex) {;}
              }
      }



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

        Attachments

          Activity

            People

            Assignee:
            amfowler Anne Fowler (Inactive)
            Reporter:
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: