problems with removing and adding swing components.
Author |
Message |
facultyofmusic
![](http://compsci.ca/v3/uploads/user_avatars/15137545114a8c72a6dc7e5.gif)
|
Posted: Sat Sep 26, 2009 9:37 pm Post subject: problems with removing and adding swing components. |
|
|
Hello again, I've started on my game and I'm stuck on a part that has to do with swing, here's situation:
I have a game window (GameApp.frame).
I have a main menu (MainMenu(GameApp.frame) extends JPanel).
Inside MainMenu it will make the menu and add it self to the game window.
the above all went smoothly, but here's the problem.
I press options, the MainMenu remves itself from the game window by calling the remove method of the frame.
MainMenu makes a new instance of class Options.
the Options class is another class just like MainMenu that extends JFrame.
Options adds itself to the game window.
This is where the problem occurred. After The MainMenu removes itself and the Options adds itself to the frame, it won't show. I tried calling update() after finish initializing the options, but it still won't show.
I don't know the reason to this, has anyone else ever encountered something similar to this? If you have, what's wrong with my code? ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
andrew.
|
Posted: Sat Sep 26, 2009 9:46 pm Post subject: RE:problems with removing and adding swing components. |
|
|
You should post the code so we can look through it. |
|
|
|
|
![](images/spacer.gif) |
|
|