// GameWithDialogBoxInput.java (c) 2003 Kari Laitinen import javax.swing.* ; class GameWithDialogBoxInput { public static void main( String[] command_line_parameters ) { int integer_from_keyboard ; int one_larger_integer ; System.out.print( "\n This program is a computer game. Please, type in " + "\n an integer in the range 1 ... 2147483646 : " ) ; String integer_as_string = JOptionPane.showInputDialog( "Type in the integer" ) ; integer_from_keyboard = Integer.parseInt( integer_as_string ) ; one_larger_integer = integer_from_keyboard + 1 ; System.out.print( "\n You typed in " + integer_from_keyboard + "." + "\n My number is " + one_larger_integer + "." + "\n Sorry, you lost. I won. The game is over.\n") ; System.exit( 0 ) ; } }