FileDocCategorySizeDatePackage
CoordinatesDemo.javaAPI DocExample2725Tue Dec 12 18:58:52 GMT 2000None

CoordinatesDemo

public class CoordinatesDemo extends Applet

Fields Summary
FramedArea
framedArea
Label
label
Constructors Summary
Methods Summary
public voidinit()

        GridBagLayout gridBag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();

        setLayout(gridBag);

        framedArea = new FramedArea(this);
        c.fill = GridBagConstraints.BOTH;
        c.weighty = 1.0;
        c.gridwidth = GridBagConstraints.REMAINDER; //end row
        gridBag.setConstraints(framedArea, c);
        add(framedArea);

        label = new Label("Click within the framed area.");
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        c.weighty = 0.0;
        gridBag.setConstraints(label, c);
        add(label);
    
public voidupdateLabel(java.awt.Point point)

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