• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a start menu to my game

 
mel li
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I asked this question before but I'm still confused. This is my code from a game that is like Fruit Ninja. I did not finish it yet. I'm trying to create a start menu for this game using JButtons and Cardlayout. The buttons should display "Play" and "Exit". And once the user clicks on the play button, the window should switch to the Furutsu Panel and the buttons should disappear. The exit button should make the window simply disappear. I know how to use CardLayout but I don't know how to implement in my game. Any help would be appreciated.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you start with a start() method for the game. Get that working, then it sill be reasonably easy to add a button. Similarly for the other menus. Then consider where to put the buttons in the layout.

Can I remind you that most people would add a menu bar and put the start menu on that.
 
Fred Kleinschmidt
Bartender
Posts: 460
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do NOT call repaint() from your paintComponent() method!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!