import java.awt.*;
import java.awt.event.*;

// A variation of a class that appears in Core Web
// Programming from Prentice Hall. May be freely used
// or adapted.
// 1999 Marty Hall, http://www.apl.jhu.edu/~hall/java/

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().doLayout();
  }
}

