Assignment 3 - ShapesTest
/*
Test for Shapes
*/
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class ShapesTest
{
public static void main ( String args[] )
{
//obtain user's choice
String input = JOptionPane.showInputDialog(
"Enter 1 to draw rectangles\n" +
"Enter 2 to draw ovals" );
int choice = Integer.parseInt( input ); //converts input to int
//create the panel with the user's input
Shapes panel = new Shapes( choice );
JFrame application = new JFrame(); //creates new JFrame
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
application.add( panel);
application.setSize( 300, 300);
application.setVisible( true );
}
}
No comments:
Post a Comment