
/**
 * Demonstration of using simple JOptionPane methods for input
 * 
 * @author Russell C. Bjork
 * copyright (c) 2004, 2006
 * 
 */

import javax.swing.*;
import objectdraw.*;

public class JOptionPaneDemo extends WindowController
{
    private Text instructions;
    
    public void begin()
    {
       instructions = new Text("Please click", 100, 100, canvas);
    }
    
    public void onMouseClick(Location point)
    {
        
        int firstNumber = Integer.parseInt(
            JOptionPane.showInputDialog(this, "Please type an integer"));
        int secondNumber = Integer.parseInt(
            JOptionPane.showInputDialog(this, "Please type another integer"));
        instructions.setText("Their sum is " + (firstNumber + secondNumber));
    }
}
