import javax.swing.*;
/**
 * a subclass of JFrame that can displays three
 * additional JFrames in a stair pattern.  The
 * three additional JFrames are the same size
 * as the original.
 */
public class StairWindow extends JFrame {
  
  /**
   * three additional JFrames to display in a
   * stair pattern.
   */
  private JFrame w1= new JFrame(),
    w2= new JFrame(),
    w3= new JFrame();
  
  /**
   * show three additional windows in a stair
   * pattern up and to the right.  The lower
   * left corner of each JFrame touches the
   * upper right corner of the previous one.
   */
  public void up() {
    w1.setLocation(getX() + getWidth(),
                   getY() - getHeight());
    w1.setSize(getWidth(), getHeight());
    w2.setLocation(getX() + 2 *getWidth(),
                   getY() - 2 *getHeight());
    w2.setSize(getWidth(), getHeight());
    w3.setLocation(getX() + 3 * getWidth(),
                   getY() - 3 * getHeight());
    w3.setSize(getWidth(), getHeight());
    w1.show();
    w2.show();
    w3.show();
  }
    
   public void down() {
    w1.setLocation(getX() + getWidth(),
                   getY() + getHeight());
    w1.setSize(getWidth(), getHeight());
    w2.setLocation(getX() + 2 *getWidth(),
                   getY() + 2 *getHeight());
    w2.setSize(getWidth(), getHeight());
    w3.setLocation(getX() + 3 * getWidth(),
                   getY() + 3 * getHeight());
    w3.setSize(getWidth(), getHeight());
    w1.show();
    w2.show();
    w3.show();
  }
 
}