import java.awt.*;
//import javax.swing.*;
import java.applet.*;
import java.awt.event.*;
	
//public class DrawablePetApplet extends JApplet {
public class DrawablePetApplet extends Applet implements ActionListener {

    private DrawablePet pet = 
         new DrawablePet("Spidey", 60, new Point(50,10), Color.green);;
    private Label nameLabel = new Label("Hi. I'm " 
           + pet.getName() +  " and I'm " + pet.getSize() + " pixels tall.");      
    private Button growButton = new Button("Grow!");
    private Button shrinkButton = new Button("Shrink!");
    
    public void init() {
        growButton.addActionListener(this);   // Initialize the interface
        shrinkButton.addActionListener(this);
        add(nameLabel);        
        add(growButton);
        add(shrinkButton);
        setSize(400,400);
    }
	
    public void paint(Graphics g) {
        nameLabel.setText("Hi. I'm " 
           + pet.getName() +  " and I'm " + pet.getSize() + " pixels tall.");      
        pet.setLocation( new Point(100, 100 ) );
        pet.draw(g);
    }

    public void actionPerformed (ActionEvent evt) {
        if (evt.getSource() == growButton)   // If grow button 
            pet.scale(1.05);                 //    grow by 5 percent
        else                                 // If shrink button
            pet.scale(0.95);                 //    shrink by 5 percent
        repaint();
    } // actionPerformed()
} // DrawablePetApplet.java
