Removing JPanel from JFrame
I am currently working on an intro screen for a game developed using JOGL. I want the introduction to be a JPanel with a few buttons to change parameters before starting the game.
So I have a JFrame to which I add a GLCanvas. GLCanvas also contains a GLEventListener. Finally, I add the JPanel.
I have overridden JPanel's paintComponent method to set the background image. I have several buttons inside the panel. Whenever you press the play button, it calls a function that does the following:
frame.remove (JPanel); frame.repaint (); animator.start ();
What happens is that my JPanel goes away correctly, but when repaint is called, my frame is just filled with gray. I know that the animator starts correctly when the display method in my GLEventListener is called.
Does anyone know what the problem is?