示例#1
0
 /** Resets the program to its initial state. */
 public void reset() {
   frame.clearDrawables(); // removes drawables added by the user
   control.setValue("xleft", 3); // sets default input values
   control.setValue("ytop", 3);
   control.setValue("width", 1.0);
   control.setValue("height", 1.5);
 }
示例#2
0
 /** Creates a rectangle and adds it to the DisplayFrame. */
 public void calculate() {
   // gets rectangle location
   double left = control.getDouble("xleft");
   double top = control.getDouble("ytop");
   // gets rectangle dimensions
   double width = control.getDouble("width");
   double height = control.getDouble("height");
   Drawable rectangle = new WorldRectangle(left, top, width, height);
   frame.addDrawable(rectangle);
   // frame is automatically rendered after Calculate button is pressed
 }
示例#3
0
 /** Constructs the DrawingApp and sets the world coordinate scale. */
 public DrawingWorldApp() {
   frame.setPreferredMinMax(0, 10, 0, 10);
 }