import javax.swing.*; /** an instance is like a JFrame but it has more methods. */ public class SquareJFrame extends JFrame { /** * Set the height of the window to its width. * There is a minimum height, so if you try * to make it smaller than that, Java won't * let you. */ public void setHeighttoWidth() { setSize(getWidth(), getWidth()); } /** Yields: area of the window */ public int area() { return getWidth() * getHeight(); } }