home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Label;
- import java.awt.Rectangle;
-
- public class RectangleDemo extends Applet {
- RFramedArea framedArea;
- Label label;
-
- public void init() {
- GridBagLayout var1 = new GridBagLayout();
- GridBagConstraints var2 = new GridBagConstraints();
- ((Container)this).setLayout(var1);
- this.framedArea = new RFramedArea(this);
- var2.fill = 1;
- var2.weighty = (double)1.0F;
- var2.gridwidth = 0;
- var1.setConstraints(this.framedArea, var2);
- ((Container)this).add(this.framedArea);
- this.label = new Label("Drag within the framed area.");
- var2.fill = 2;
- var2.weightx = (double)1.0F;
- var2.weighty = (double)0.0F;
- var1.setConstraints(this.label, var2);
- ((Container)this).add(this.label);
- ((Container)this).validate();
- }
-
- public void rectChanged(Rectangle var1) {
- this.label.setText("Rectangle goes from (" + var1.x + ", " + var1.y + ") to (" + (var1.x + var1.width - 1) + ", " + (var1.y + var1.height - 1) + ").");
- ((Component)this).repaint();
- }
- }
-