Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes parameter passing Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "parameter passing" Watch "parameter passing" New topic
Author

parameter passing

Aditya Khare
Greenhorn

Joined: Dec 28, 2011
Posts: 4

Ok so i made a game in which a random no. is generated and user have to guess it. The game gives clues like Higher or Lower to user. When a guessed no is found a new jframe opens in a new class gui.class. Now i want to pass the argumets random no and user chances ie counter to gui.class so help me
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> When a guessed no is found a new jframe opens in a new class gui.class.

why?

if the game is gui-based, you'd simply re-use/reset the components

Aditya Khare
Greenhorn

Joined: Dec 28, 2011
Posts: 4

New jframe works as a dialog box that displays random number and the user's chances
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> New jframe works as a dialog box that displays random number and the user's chances

guessing that 'user's chances' means number of guesses made.

if so, use a JOptionPane:

String message = "Random number = " + randomNumber + "\nNumber of guesses made = " + numberOfGuesses;
javax.swing.JOptionPane.showMessageDialog(null, message);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parameter passing
 
Similar Threads
GUI number guessing game program
Problem clearing and resetting a JPanel
Can we create more than one session in a Client ?
Help with number guessing game
Error Message