1 package org.enhydra.tool.swing.layout; 2 3 4 import java.io.Serializable ; 5 6 public class XYConstraints 7 implements Cloneable , Serializable 8 { 9 10 int x; 11 int y; 12 int width; 13 int height; 14 15 public XYConstraints() 16 { 17 this(0, 0, 0, 0); 18 } 19 20 public XYConstraints(int x, int y, int width, int height) 21 { 22 this.x = x; 23 this.y = y; 24 this.width = width; 25 this.height = height; 26 } 27 28 public int getX() 29 { 30 return x; 31 } 32 33 public void setX(int x) 34 { 35 this.x = x; 36 } 37 38 public int getY() 39 { 40 return y; 41 } 42 43 public void setY(int y) 44 { 45 this.y = y; 46 } 47 48 public int getWidth() 49 { 50 return width; 51 } 52 53 public void setWidth(int width) 54 { 55 this.width = width; 56 } 57 58 public int getHeight() 59 { 60 return height; 61 } 62 63 public void setHeight(int height) 64 { 65 this.height = height; 66 } 67 68 public int hashCode() 69 { 70 return x ^ y * 37 ^ width * 43 ^ height * 47; 71 } 72 73 public boolean equals(Object that) 74 { 75 if(that instanceof XYConstraints) 76 { 77 XYConstraints other = (XYConstraints)that; 78 return other.x == x && other.y == y && other.width == width && other.height == height; 79 } else 80 { 81 return false; 82 } 83 } 84 85 public Object clone() 86 { 87 return new XYConstraints(x, y, width, height); 88 } 89 90 public String toString() 91 { 92 return String.valueOf(String.valueOf((new StringBuffer ("XYConstraints[")).append(x).append(",").append(y).append(",").append(width).append(",").append(height).append("]"))); 93 } 94 } 95 | Popular Tags |