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!!!

Recommended Answers

All 3 Replies

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
         }

      });

If that answers your question please mark this thread "solved" for our knowledge base. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.