1 22 package com.izforge.izpack.gui; 23 24 import java.awt.Component ; 25 import java.awt.Rectangle ; 26 27 31 public class IzPanelConstraints implements Cloneable , LayoutConstants 32 { 33 34 39 private int xCellAlignment = IzPanelLayout.DEFAULT_X_ALIGNMENT[0]; 40 41 private int yCellAlignment = IzPanelLayout.DEFAULT_Y_ALIGNMENT[0]; 42 43 private int xPos = 0; 44 45 private int yPos = NEXT_ROW; 46 47 private int xWeight = 1; 48 49 private int yWeight = 1; 50 51 private int xGap = IzPanelLayout.DEFAULT_X_GAPS[-LABEL_GAP]; 52 53 private int yGap = IzPanelLayout.DEFAULT_Y_GAPS[-LABEL_GAP]; 54 55 private double xStretch = 0.0; 56 57 private double yStretch = 0.0; 58 59 private Rectangle bounds; 60 61 62 Component component = null; 63 64 65 int preferredHeight = 0; 66 67 72 public double getXStretch() 73 { 74 return xStretch; 75 } 76 77 82 public void setXStretch(double stretch) 83 { 84 this.xStretch = stretch; 85 } 86 87 92 public double getYStretch() 93 { 94 return yStretch; 95 } 96 97 102 public void setYStretch(double stretch) 103 { 104 this.yStretch = stretch; 105 } 106 107 112 public int getXGap() 113 { 114 return xGap; 115 } 116 117 122 public void setXGap(int gap) 123 { 124 xGap = gap; 125 } 126 127 132 public int getYGap() 133 { 134 return yGap; 135 } 136 137 142 public void setYGap(int gap) 143 { 144 yGap = gap; 145 } 146 147 161 public IzPanelConstraints(int xCellAlignment, int yCellAlignment, int xPos, int yPos, 162 int xWeight, int yWeight, int xGap, int yGap, double xStretch, double yStretch) 163 { 164 this.xCellAlignment = xCellAlignment; 165 this.yCellAlignment = yCellAlignment; 166 this.xPos = xPos; 167 this.yPos = yPos; 168 this.xWeight = xWeight; 169 this.yWeight = yWeight; 170 setXGap(xGap); 171 setYGap(yGap); 172 setXStretch(xStretch); 173 setYStretch(yStretch); 174 } 175 176 179 public IzPanelConstraints() 180 { 181 super(); 182 } 183 184 189 public Object clone() 190 { 191 try 192 { 193 IzPanelConstraints c = (IzPanelConstraints) super.clone(); 194 return c; 195 } 196 catch (CloneNotSupportedException e) 197 { 198 throw new InternalError (); 200 } 201 } 202 203 208 public int getXCellAlignment() 209 { 210 return xCellAlignment; 211 } 212 213 218 public void setXCellAlignment(int cellAlignment) 219 { 220 xCellAlignment = cellAlignment; 221 } 222 223 228 public int getXPos() 229 { 230 return xPos; 231 } 232 233 238 public void setXPos(int pos) 239 { 240 xPos = pos; 241 } 242 243 249 public int getXWeight() 250 { 251 return xWeight; 252 } 253 254 259 public void setXWeight(int weight) 260 { 261 xWeight = weight; 262 } 263 264 269 public int getYCellAlignment() 270 { 271 return yCellAlignment; 272 } 273 274 279 public void setYCellAlignment(int cellAlignment) 280 { 281 yCellAlignment = cellAlignment; 282 } 283 284 289 public int getYPos() 290 { 291 return yPos; 292 } 293 294 299 public void setYPos(int pos) 300 { 301 yPos = pos; 302 } 303 304 310 public int getYWeight() 311 { 312 return yWeight; 313 } 314 315 320 public void setYWeight(int weight) 321 { 322 yWeight = weight; 323 } 324 325 331 public Rectangle getBounds() 332 { 333 if (bounds != null) return (Rectangle ) (bounds.clone()); 334 return (new Rectangle ()); 335 } 336 337 342 public void setBounds(Rectangle bounds) 343 { 344 this.bounds = (Rectangle ) bounds.clone(); 345 } 346 } 347 | Popular Tags |