/* javalessons.com
For educational purposes only.
See javalessons.com/terms.html Use at own risk.
*/
import java.awt.event.* ;
import java.awt.* ;
import java.applet.*;
public class Excercise7
extends Applet
implements ActionListener
{
Button butt ;
int w=0;
int h=0;
public void paint ( java.awt.Graphics gr )
{
gr.drawRect ( 50, 70, w, h );
}
public void actionPerformed ( ActionEvent ev )
{
setBackground ( Color.cyan ) ;
butt.setLabel ( "Ouch, not that hard !" ) ;
w = 150; h = 110 ;
repaint();
}
public Excercise7()
{
butt = new Button ( "Press me, if you please" ) ;
}
public void init()
{
butt.addActionListener ( this ) ;
setBackground ( Color.pink ) ;
add ( butt ) ;
validate () ;
}
}