Hidden Pulldown Menu

Started by peter88, July 03, 2007, 19:26:55

Previous topic - Next topic

peter88

Hi,
I've a problem. I've made swing app. with a pulldown menu ( JMenuBar() and JMenu()) and an AWTGLCanvas

If I open the pulldown menu , I can't see the menuItems because the AWTGLCanvas is drawn over the menu.
I can only see the menu bar and the AWTGLCanvas .
What can I do ?

Here is any source:


...
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.AWTGLCanvas;


public class MyGlCanvas extends AWTGLCanvas
{
   MyGlCanvas() throws LWJGLException
   {
      ...
   }
.
.
.
}


public class MyMainClass
{
..
..
   private JFrame getJFrame()
   {
      if (jFrame == null)
      {
         jFrame = new JFrame();
         jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         jFrame.setJMenuBar(getJJMenuBar());
         jFrame.setSize(300, 200);
         jFrame.setContentPane(getJContentPane());
         jFrame.setTitle("Application");
      }
      return jFrame;
   }

   private JPanel getJContentPane()
   {
      try
      {
      if (jContentPane == null)
      {
         jContentPane = new JPanel();
         jContentPane.setLayout(new BorderLayout());
         glCanvas=new MyGlCanvas();  // here is OpenGL
         jContentPane.add(glCanvas);
      }
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
      return jContentPane;
   }

...
..
}

peter88

I found the solution  :)

JPopupMenu.setDefaultLightWeightPopupEnabled(false);
must be set before  the menu is created.