hi all, I am trying to design a game app that uses a swing gui as a main menu. so far I have been a little confused as to how I get my 'start new game' button to actually launch the game. I have googled event handlers and cannot seem to find anything. I have 2 classes for my project one is the gui, the other is the game itself. the gui class has an inner class that deals with events. the gui class is named menuGUI and the game class is just called game. I suppose the issue is that the event handler needs to call the 'game' class but im a little unsure as to how to call other classes from one class. any help would be much appreciated.
majestic0110
187
Nearly a Posting Virtuoso
Recommended Answers
Jump to PostYour handler just needs to create an instance of the game class if you don't already have one and call whatever method starts the game
Game game = new Game(); game.start();
Jump to PostAh, your game is an applet. You should convert it to a JFrame or JPanel if you wish to run it from your GUI. That is only a minimal bit of work. You'll need to do the init() work in either your constructor or call the method yourself after you …
All 6 Replies
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
majestic0110
187
Nearly a Posting Virtuoso
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
majestic0110
187
Nearly a Posting Virtuoso
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
majestic0110
187
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.