FileDocCategorySizeDatePackage
RectangleDemo.javaAPI DocExample3258Tue Dec 12 18:59:06 GMT 2000None

RectangleDemo

public class RectangleDemo extends JApplet

Fields Summary
JLabel
label
Constructors Summary
Methods Summary
voidbuildUI(java.awt.Container container)

        container.setLayout(new BoxLayout(container,
                                          BoxLayout.Y_AXIS));

        RectangleArea rectangleArea = new RectangleArea(this);
        container.add(rectangleArea);

        label = new JLabel("Click within the framed area.");
        container.add(label);

        //Align the left edges of the components.
        rectangleArea.setAlignmentX(LEFT_ALIGNMENT);
        label.setAlignmentX(LEFT_ALIGNMENT); //unnecessary, but doesn't hurt
    
public voidinit()

        buildUI(getContentPane());
    
public static voidmain(java.lang.String[] args)

        JFrame f = new JFrame("RectangleDemo");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        RectangleDemo controller = new RectangleDemo();
        controller.buildUI(f.getContentPane());
        f.pack();
        f.setVisible(true);
    
public voidupdateLabel(java.awt.Point point)

        label.setText("Click occurred at coordinate ("
                      + point.x + ", " + point.y + ").");