/**  ReadInteger:     Simple program to read an integer
 *                    and print it out again using the 
 *                    local Display class.
 *
 */

import uk.ac.ed.ph.sciprog.*;              // Import Display classes


public class ReadInteger{                       // Define main class
    public static void main(String args[]){     // main program start

    //                 Setup the Display 

    Display panel = new Display("A simple input/output program");
    Input number = new Input("Give an integer", 10);     // Construct input
    panel.addInput(number);                              // Add to display

    //                  Loop ``for ever'' reading + writing   
    //                  See next section on loops for details.
    while( true ){

	 //             Print message, wait until ready, then read integer
	panel.println("Change integer and then press GO button");
	panel.waitForButtonPress();

	int iValue = number.getInt();                   // Read the integer
	
	//            Print out the integer to the output part of the Display

	panel.println("Value of integer is : " + iValue);
    }                            
  }
}
