コード例 #1
0
ファイル: URLTool.java プロジェクト: mmohan01/MultiRefactor
 private Rectangle fieldBounds(Figure figure) {
   Rectangle box = figure.displayBox();
   int nChars = Math.max(20, getURL(figure).length());
   Dimension d = fTextField.getPreferredSize(nChars);
   box.x = Math.max(0, box.x + (box.width - d.width) / 2);
   box.y = Math.max(0, box.y + (box.height - d.height) / 2);
   return new Rectangle(box.x, box.y, d.width, d.height);
 }
コード例 #2
0
 public void drawingInvalidated(DrawingChangeEvent e) {
   Rectangle r = e.getInvalidatedRectangle();
   if (getDamage() == null) {
     setDamage(r);
   } else {
     // don't manipulate rectangle returned by getDamage() directly
     // because it could be a cloned rectangle.
     Rectangle damagedR = getDamage();
     damagedR.add(r);
     setDamage(damagedR);
   }
 }
コード例 #3
0
 /** Finds a top level Figure that intersects the given rectangle. */
 public Figure findFigure(Rectangle r) {
   FigureEnumeration k = figuresReverse();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     Rectangle fr = figure.displayBox();
     if (r.intersects(fr)) return figure;
   }
   return null;
 }
コード例 #4
0
 /**
  * Finds a top level Figure that intersects the given rectangle. It supresses the passed in
  * figure. Use this method to ignore a figure that is temporarily inserted into the drawing.
  */
 public Figure findFigure(Rectangle r, Figure without) {
   if (without == null) return findFigure(r);
   FigureEnumeration k = figuresReverse();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     Rectangle fr = figure.displayBox();
     if (r.intersects(fr) && !figure.includes(without)) return figure;
   }
   return null;
 }
コード例 #5
0
 public void basicMoveBy(int x, int y) {
   fDisplayBox.translate(x, y);
 }
コード例 #6
0
 public void basicDisplayBox(Point origin, Point corner) {
   fDisplayBox = new Rectangle(origin);
   fDisplayBox.add(corner);
 }