View Javadoc

1   /*
2    * this class is for generating a java.awt.Rectangle using interface ShapeBean and the method genShape(...)
3    * the rectngle (Shape) will be using to define a clickable part on the ImageIcon
4    * all methods set and get and constructor without argument are for generating a xml file with java.beans.XMLEncoder
5    */
6   package org.lsst.ccs.utilities.zonesui;
7   
8   import java.awt.Shape;
9   
10  /**
11   *
12   * @author Pascal Durieu
13   */
14  public class ZRectangle implements ShapeBean {
15      private int x, y, width, height ;
16      
17      public ZRectangle() {}
18      
19      public ZRectangle (int ix, int iy, int iw, int ih) {
20          this.x = ix;
21          this.y = iy;
22          this.width = iw;
23          this.height = ih;
24      }
25      
26      //get method
27      public int getX () {return x;}
28      public int getY () {return y;}
29      public int getWidth () {return width;}
30      public int getHeight () {return height;}
31      
32      //set method
33      public void setX (int i) {this.x = i;}
34      public void setY (int i) {this.y = i;}
35      public void setWidth (int i) {this.width = i;}
36      public void setHeight (int i) {this.height = i;}
37      
38      //method from ShapeBean interface to generate a Shape
39      @Override
40      public Shape genShape() {
41          return new java.awt.Rectangle(this.x, this.y, this.width, this.height);
42      }
43      @Override
44      public String toString() {
45          return "ZRectangle ("+this.x+","+this.y+","+this.width+","+this.height+")";
46      }
47      
48  }