Hi all,

I am creating one GUI application in java. I need to make menubar visible when particular panel is made invisible. Is it possible by creating an event which will be triggered when panel is made invisible? Can anybody help me?

Thanks in advance!!!

You can use a ComponentListener, something like:

    myThing.addComponentListener(new ComponentListener() {

         @Override
         public void componentShown(ComponentEvent arg0) {
            System.out.println(arg0);
         }

         @Override
         public void componentHidden(ComponentEvent arg0) {
            System.out.println(arg0);          
         }

         @Override
         public void componentMoved(ComponentEvent arg0) {
            // not interested
         }

         @Override
         public void componentResized(ComponentEvent arg0) {
            // not interested
         }

      });

Edited 4 Years Ago by JamesCherrill

This question has already been answered. Start a new discussion instead.