aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes parameter passing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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