コード例 #1
0
  protected void checkMinimumSize() {
    Dimension d = getDrawingSize();

    if (fViewSize.height < d.height || fViewSize.width < d.width) {
      fViewSize.height = d.height + SCROLL_OFFSET;
      fViewSize.width = d.width + SCROLL_OFFSET;
      setSize(fViewSize);
    }
  }
コード例 #2
0
 /**
  * Return the size of the area occupied by the contained figures inside the drawing. This method
  * is called by checkMinimumSize().
  */
 protected Dimension getDrawingSize() {
   FigureEnumeration fe = drawing().figures();
   Dimension d = new Dimension(0, 0);
   while (fe.hasNextFigure()) {
     Rectangle r = fe.nextFigure().displayBox();
     d.width = Math.max(d.width, r.x + r.width);
     d.height = Math.max(d.height, r.y + r.height);
   }
   return d;
 }