1 4 package org.ozoneDB.core.monitor; 5 6 import java.awt.*; 7 8 9 18 public class AbsoluteConstraints implements java.io.Serializable { 19 20 21 final static int MOTIF = 0; 22 final static int WIN = 1; 23 24 static int GUI = MOTIF; 25 26 27 final static long serialVersionUID = 5261460716622152494L; 28 29 30 public int x; 31 32 public int y; 33 34 public int width = -1; 35 36 public int height = -1; 37 38 39 final static int FIXED = 0; 40 41 final static int X_ABS = 1; 42 final static int X_PROP = 2; 43 final static int Y_ABS = 4; 44 final static int Y_PROP = 8; 45 final static int X2_ABS = 16; 46 final static int X2_PROP = 32; 47 final static int Y2_ABS = 64; 48 final static int Y2_PROP = 128; 49 50 final static int MOVE_PROP = X_PROP | Y_PROP; 51 final static int MOVE_ABS = X_ABS | Y_ABS; 52 53 final static int RESIZE_PROP = X2_PROP | Y2_PROP; 54 final static int RESIZE_ABS = X2_ABS | Y2_ABS; 55 56 public int policy = FIXED; 57 58 59 63 public AbsoluteConstraints( Point pos ) { 64 this( pos.x, pos.y ); 65 } 66 67 68 73 public AbsoluteConstraints( int x, int y ) { 74 this.x = x; 75 this.y = y; 76 } 77 78 79 85 public AbsoluteConstraints( Point pos, Dimension size ) { 86 this.x = pos.x; 87 this.y = pos.y; 88 if (size != null) { 89 this.width = size.width; 90 this.height = size.height; 91 } 92 } 93 94 95 104 public AbsoluteConstraints( int x, int y, int width, int height ) { 105 this.x = x; 106 this.y = y; 107 this.width = width; 108 this.height = height; 109 } 110 111 112 113 public AbsoluteConstraints( int x, int y, int width, int height, int policy ) { 114 this.x = x; 115 this.y = y; 116 this.width = width; 117 this.height = height; 118 this.policy = policy; 119 } 120 121 122 123 public int getX() { 124 return x; 125 } 126 127 128 129 public int getY() { 130 return y; 131 } 132 133 134 138 public int getWidth() { 139 return GUI == MOTIF || width == -1 ? width : width - 3; 140 } 141 142 143 147 public int getHeight() { 148 return GUI == MOTIF || height == -1 ? height : height - 5; 149 } 150 151 152 public String toString() { 153 return super.toString() + " [x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + "]"; 154 } 155 } 156 | Popular Tags |