import java.awt.*;
import java.awt.event.*;

/** Taken from Core Web Programming from 
 *  Prentice Hall and Sun Microsystems Press,
 *  http://www.corewebprogramming.com/.
 *  &copy; 2001 Marty Hall and Larry Brown;
 *  may be freely used or adapted.
 */

public class SetSizeButton extends Button 
                           implements ActionListener {
  private int width, height;

  public SetSizeButton(int width, int height) {
    super("Resize to " + width + "x" + height);
    this.width = width;
    this.height = height;
    addActionListener(this);
  }

  public void actionPerformed(ActionEvent event) {
    getParent().setSize(width, height);
    getParent().invalidate();
    getParent().validate();
  }
}
