
12.8 Programming Activity 1: Working with Buttons 859
// end of task 1
setSize( 500, 375 );
setVisible( true );
}
// ***** 2. Student code restarts here
// Code a private class to implement the correct Listener
// and its required method
// To open the switch, call the open method with the statement
// open( );
// To close the switch, call the close method with the statement
// close( );
// The last statement of the method should be
// animate( );
// end of task 2
EXAMPLE 12.7 Location of Student Code in JButtonPractice.java
The framework will animate your code so that you can watch your code
work. For this to happen, be sure that you call the animate method. ...