my dog learned polymorphism*
The moose likes Applets and the fly likes Restart game button? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Restart game button?" Watch "Restart game button?" New topic
Author

Restart game button?

Harry Rollins
Greenhorn

Joined: May 03, 2012
Posts: 1
Hi guys,

I am a beginner Java programmer and I have made a very simple applet with the wonderful help of some great YouTube tutorials and I was wondering if you guys knew of anyway of making a button that restarted the game without having to exit and reload the game manually. Here is my main class:



Any suggestions or code alterations would be so gratefully received also any other comments on the code would be nice as well.

Thanks

PlumApps
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
create a method, separate to init() or start(), named reset()? and put your current start-up code there.
ensure you set any variables to their starting state (except for games won/lost etc).

call reset() when the applet first opens, then for a new game call reset() again,
and the screen should appear exactly as when the applet first opened.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/59241-restart-reset-button.html


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Restart game button?
 
Similar Threads
JComponents won't show until I move mouse over them
HELP2
Parallel dragging
How can i use mouse to click on an image and draw a point after i clicked ?
How do I make the paddle?