• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parameter passing

 
Aditya Khare
Greenhorn
Posts: 4
Chrome Firefox Browser Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 4
Chrome Firefox Browser Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New jframe works as a dialog box that displays random number and the user's chances
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic