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

Pural PopupMenus appear at the same time.

XMLWordPrintable

    • 1.1.8
    • sparc
    • solaris_2.5.1
    • Verified


        chosho.kyo@japan 1998-11-03

        [Work Environment]
        WS: Ultra10
        OS: Solaris2.5.1J
        Window: CDE1.02
        Patch: 103461-28
                103566-36
                104338-02
        JRE: JRE1.1.6FCS

        [Phenomenon] Pural PopupMenus will appear at the same time,
                     when quickly clicking a button added on a Frame.
               
        [Steps to reproduce it]

        Step1: Complile source and run it as follows.
                   javac S017.java
                   jre -cp . S017

        Step2: Observe the follows.
               A frame named AWTapp with a button titled "Button.add(PopupMenu)" appears.

        Step3: Observe the following 2 facts.
               (1)Quickly click the button with MB1 from right side of the button,
                  and slide mouse to left side of the button slowly with keeping
                  quick clicking. Then the image of S017.gif can be observed.
               
               (2)Just quickly click the button until the mouse console gets frozen,
                  hit Esc-key to release the freeze, then the image of S017.gif can
                  be observed.
                  
               * (1) is easily observed.
               
        //---------Start S017.java-------------
        import java.awt.*;
        import java.awt.event.*;

        public class S017 extends Frame {
            
            Button button1 = new Button("Button.add(PopupMenu)");
            Panel panel1 = new Panel();
            BorderLayout borderLayout1 = new BorderLayout();
            
            public S017() {
                setSize(new Dimension(300, 150));
                setLayout(borderLayout1);
                panel1.add(button1, null);
                add(panel1, BorderLayout.CENTER);
                
                button1.addMouseListener(new java.awt.event.MouseAdapter() {
                    public void mousePressed(MouseEvent e) {
                        PopupMenu pm = new PopupMenu("button1");
                        MenuItem m1, m2;
                        m1 = new MenuItem("menu 1");
                        m2 = new MenuItem("menu 2");
                        pm.add(m1);
                        pm.add(m2);
                        button1.add(pm);
                        pm.show(button1,e.getX(),e.getY());
                    }
                });
                
            }

            public static void main(String[] args) {
                S017 frame11 = new S017();
                frame11.setVisible(true);
            }
        }
        //---------End S017.java-------------

              dassunw Das Das (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: