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

JInternalFrame don't hide JMenuItem when setVisible(false)

XMLWordPrintable

      Name: sl110371 Date: 06/20/2000


      K:\CCSS\BOSS\lmcslib\test>java -version
      java version "1.3.0rc2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc2-Y)
      Java HotSpot(TM) Client VM (build 1.3.0rc2-Y, mixed mode)


      JMenuItem don't get hidden when JInternalFrame.setVisible(false).
      Try this little exemple:

      1. Open the JMenu "test menu" in "JInternalFrame1" and point at the
      "TEST" JMenuItem.
      2. Move the mouse down over to "JInternalFrame2".

      The "JInternalFrame1" is hidden, but the JMenuItem is still visible..(?)



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

      public class InternalTest extends JFrame implements MouseListener{
        JInternalFrame i1 = new JInternalFrame("JInternalFrame 1");
        JInternalFrame i2 = new JInternalFrame("JInternalFrame 2");

        public InternalTest(){
          setBounds(100,10,400,400);

          JDesktopPane layeredPane = new JDesktopPane();

          setContentPane(layeredPane);

          i1.setBounds(10,10,200,100);
          layeredPane.add(i1);


          JMenuBar menubar = new JMenuBar();
          JMenu menu = new JMenu("test menu");
          JMenuItem menuitem = new JMenuItem("TEST");
          menu.add(menuitem);
          menubar.add(menu);
          i1.setJMenuBar(menubar);
          i1.setVisible(true);


          i2.setBounds(10,120,200,100);
          i2.addMouseListener(this);
          layeredPane.add(i2);

          i2.setVisible(true);
          setVisible(true);
        }


        public void mouseExited(MouseEvent e){}
        public void mouseEntered(MouseEvent e){
          i1.setVisible(false);
        }
        public void mouseReleased(MouseEvent e){}
        public void mousePressed(MouseEvent e){}
        public void mouseClicked(MouseEvent e){}


        public static void main(String[] args){
          InternalTest t = new InternalTest();
        }
      }
      (Review ID: 103577)
      ======================================================================

            mbronsonsunw Mike Bronson (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: