I have an MDI application with which I want to
switch the menubar of the desktop pane depending on
which window is active.  In the following version of my test app,
the toggling works, and Menu1 shows up fine on its turn, but
garbage pixels show up for Menu2 on its turn...


class whatever {
     JDesktopPane desktop=new JDesktopPane();
     JMenuBar menu1=new JMenuBar();
     JMenuBar menu2=new JMenuBar();
     JMenu menu1=new JMenu("menu1");
     JMenu menu2=new JMenu("menu2");

     private InternalFrameListener listener=new InternalFrameListener() {
          internalFrameActivated(internalFrameEvent e)  {
               if(toggle) {
                    toggle=false;
                    //mainFrame.remove(menu2);  //doesn't help
                    mainFrame.setJMenuBar(menu1);
               } else {
                    toggle=true;
                    //mainFrame.remove(menu1);  //doesn't help
                    mainFrame.setJMenuBar(menu2);
               }
               //frame.repaint(); // doesn't help
          }
          ...
     }

     main() {
          ...
          mainFrame.setContentPane(desktop); // where mainFrame is just my
application frame
          mainFrame.setJMenuBar(menu1);
          ...
     }
};


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to