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

JMenu setDelay at 0 fails to repaint submenus

    Details

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

      Description

      To reproduce the bug compile and run the sample below. Mouse through the menu and observe the menus act corectly. Click the setDelay to 0 button and again mouse through the menu.

      Observe: Menus fail to repaint (go away). Solaris and Winows 98.

      JCK 1.3 test failure, JMenuTest0003

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

      public class JFrame1 extends javax.swing.JFrame {
         
          javax.swing.JMenuBar JMenuBar1 = new javax.swing.JMenuBar();
      javax.swing.JMenu JMenu1 = new javax.swing.JMenu();
      javax.swing.JMenu JMenu2 = new javax.swing.JMenu();
      javax.swing.JMenuItem JMenuItem2 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem3 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem4 = new javax.swing.JMenuItem();
      javax.swing.JMenu JMenu3 = new javax.swing.JMenu();
      javax.swing.JMenuItem JMenuItem5 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem6 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem7 = new javax.swing.JMenuItem();
      javax.swing.JMenu JMenu4 = new javax.swing.JMenu();
      javax.swing.JMenuItem JMenuItem8 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem9 = new javax.swing.JMenuItem();
      javax.swing.JMenuItem JMenuItem10 = new javax.swing.JMenuItem();
      javax.swing.JButton JButton1 = new javax.swing.JButton();
      javax.swing.JButton JButton2 = new javax.swing.JButton();

      public JFrame1() {
      setJMenuBar(JMenuBar1);
      getContentPane().setLayout(null);
      setSize(405,305);
      setVisible(false);
      JMenu1.setText("foo");
      JMenuBar1.add(JMenu1);
      JMenu2.setText("a");
      JMenu1.add(JMenu2);
      JMenuItem2.setText("a");
      JMenu2.add(JMenuItem2);
      JMenuItem3.setText("b");
      JMenu2.add(JMenuItem3);
      JMenuItem4.setText("c");
      JMenu2.add(JMenuItem4);
      JMenu3.setText("b");
      JMenu1.add(JMenu3);
      JMenuItem5.setText("a");
      JMenu3.add(JMenuItem5);
      JMenuItem6.setText("b");
      JMenu3.add(JMenuItem6);
      JMenuItem7.setText("c");
      JMenu3.add(JMenuItem7);
      JMenu4.setText("c");
      JMenu1.add(JMenu4);
      JMenuItem8.setText("a");
      JMenu4.add(JMenuItem8);
      JMenuItem9.setText("b");
      JMenu4.add(JMenuItem9);
      JMenuItem10.setText("c");
      JMenu4.add(JMenuItem10);
      JButton1.setText("set delay 0");
      getContentPane().add(JButton1);
      JButton1.setBounds(52,106,268,58);
      JButton2.setText("set delay 1");
      getContentPane().add(JButton2);
      JButton2.setBounds(52,180,268,58);
              //add listeners
      DoAction doAction = new DoAction();
      JButton1.addActionListener(doAction);
      JButton2.addActionListener(doAction);
      }

      static public void main(String args[]) {
      (new JFrame1()).setVisible(true);
      }


      class DoAction implements java.awt.event.ActionListener {
      public void actionPerformed(java.awt.event.ActionEvent event) {
      Object object = event.getSource();
      if (object == JButton1)
      JButton1_action(event);
      else if (object == JButton2)
      JButton2_action(event);
      }
      }

      void JButton1_action(java.awt.event.ActionEvent event) {
      try {
      JMenu1.setDelay(0);
      JMenu2.setDelay(0);
      JMenu3.setDelay(0);
      JMenu4.setDelay(0);
      } catch (java.lang.Exception e) {}
      }


      void JButton2_action(java.awt.event.ActionEvent event) {
      try {
      JMenu1.setDelay(1);
      JMenu2.setDelay(1);
      JMenu3.setDelay(1);
      JMenu4.setDelay(1);
      } catch (java.lang.Exception e) {}
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              apikalev Andrey Pikalev
              Reporter:
              jdixonsunw John Dixon (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: