void resizeMarker(Point point) { Rectangle bounds = new Rectangle(startLocation); bounds.add(point); overlay.setPreferredLocation(bounds.getLocation()); overlay.setPreferredSize(bounds.getSize()); }
public Rectangle getFollowerBounds() { // find the total bounds of all the components Rectangle bounds = new Rectangle(getBounds()); for (Visual sklComp : getFollowers()) { bounds.add(sklComp.getBounds()); } return bounds; } //</editor-fold>
public void addRegion(Element region){ if (regions.isEmpty()){ setActualBounds(region.getRectangle()); }else{ Rectangle bounds = getBounds(); bounds.add(region.getRectangle()); setActualBounds(bounds); } regions.add(region); }
@Override public void actionPerformed(ActionEvent e) { float r = funcr.getValue(count); int x = (int) (origin.x + (int) radius * Math.sin(r)); int y= (int) (origin.y + (int) radius * Math.cos(r)); Point p = new Point(x,y); Rectangle r1 = comp.getBounds(); comp.setLocation(p); // r1 stores the union of the bounds before/after the animated step Rectangle r2 = comp.getBounds(); r1.add(r2); comp.getParent().getParent().repaint(r1.x,r1.y,r1.width,r1.height); //repaint(r1); // comp.getParent().invalidate(); // comp.repaint(); if (count == repeatCount) count = 0; else count++; } }
@Override public void actionPerformed(ActionEvent e){ if ( count <= repeatCount){ int x = (int) tfuncx.getValue(count); int y = (int) tfuncy.getValue(count); count++; Rectangle r1 = comp.getBounds(); comp.setActualLocation(x,y); Rectangle r2 = comp.getBounds(); r1.add(r2); Container c = comp.getParent(); if (c != null){ c.getParent().getParent().repaint(r1.x,r1.y,r1.width,r1.height); } }else{ timer.stop(); } }
@Override public void componentMoved(ComponentEvent e) { Rectangle r = getBounds(); updateBounds(); r.add(getBounds()); if (getTopLevelAncestor() != null) getTopLevelAncestor().repaint(r.x,r.y,r.width,r.height); }
@Override public void updateComponent() { setForeground(colorFront); Rectangle dirtyBounds = getBounds(); if (from != null && to != null) { source = from.getCenter(); destination = to.getCenter(); } Rectangle r = new Rectangle(getSource()); r.add(getDestination()); r.grow(10, 10); setActualBounds(r); dirtyBounds.add(getBounds()); if (getTopLevelAncestor() != null) { getTopLevelAncestor().repaint(dirtyBounds.x, dirtyBounds.y, dirtyBounds.width, dirtyBounds.height); } if (hasComponents) { updateVisibility(); } }
@Override public void actionPerformed(ActionEvent e) { if (isRunning()) { Rectangle r = sklComponent.getBounds(); //setActualLocation((int) x, (int) y); animate(); r.add(sklComponent.getBounds()); if (sklComponent.getTopLevelAncestor() != null) { sklComponent.getTopLevelAncestor().repaint(r.x, r.y, r.width, r.height); } } else { timer.stop(); if (looping) { start(); } else { animationRunning = false; if (listener != null) { listener.animationCompleted(); } } } } }
bufferedTargetArea.add( // exand top/right screenSize.x + screenSize.width + REPROJECTION_RASTER_GUTTER, screenSize.y + screenSize.height + REPROJECTION_RASTER_GUTTER); bufferedTargetArea.add( // exand bottom/left screenSize.x - REPROJECTION_RASTER_GUTTER, screenSize.y - REPROJECTION_RASTER_GUTTER);
private void makeComponent() { if (layout == Layout.TOP) { triangle.rotate(0); dx = 0; dy = 0; triangle.setLocationRelativeToComponent(rbox, Layout.BOTTOM); } else if (layout == Layout.BOTTOM) { dx = 0; dy = TRIANGLE_SIZE; triangle.rotate(Math.PI); triangle.setLocationRelativeToComponent(rbox, Layout.TOP); } else if (layout == Layout.LEFT) { dx = 0; dy = 0; triangle.rotate(-Math.PI / 2); triangle.setLocationRelativeToComponent(rbox, Layout.RIGHT); } else if (layout == Layout.RIGHT) { dx = TRIANGLE_SIZE; dy = 0; triangle.rotate(Math.PI / 2); triangle.setLocationRelativeToComponent(rbox, Layout.LEFT); } Rectangle bounds = rbox.getBounds(); bounds.add(triangle.getBounds()); setActualBounds(bounds); }
rect.add(comp.getBounds()); }else if (relationship == INTERSECTION){ rect = rect.intersection(comp.getBounds());
/** Enlarge the 2D universe so that all Displayable in the collection fit in it; * that is, that no Displayable has a negative x,y position or lays beyond bounds.*/ synchronized public void enlargeToFit(final Collection<? extends Displayable> ds) { Rectangle r = null; for (Displayable d : ds) { if (null == r) r = d.getBoundingBox(); else r.add(d.getBoundingBox()); } if (null == r) return; //empty collection r.add(get2DBounds()); setDimensions(r.x, r.y, r.width, r.height); }
@Override public Rectangle getRepaintBounds() { final Rectangle b = display.getSelection().getLinkedBox(); b.add(floater.getBoundingBox(new Rectangle())); return b; }
private void paintRootElementBackground(RenderingContext c, PaintingInfo pI) { Dimension marginCorner = pI.getOuterMarginCorner(); Rectangle canvasBounds = new Rectangle(0, 0, marginCorner.width, marginCorner.height); canvasBounds.add(c.getViewportRectangle()); c.getOutputDevice().paintBackground(c, getStyle(), canvasBounds, canvasBounds, BorderPropertySet.EMPTY_BORDER); }
public static Rectangle findLayerRect(CssContext c, Layer layer) { Box container = layer.getMaster(); Rectangle bounds = getBoxRect(c, container); // Floaters may be outside master box. // TODO: If this layer was triggered by a transform (not a positioned element) // then child positioned boxes may also fall otuside master box. for (BlockBox floater : layer.getFloats()) { Rectangle fBounds = getBoxRect(c, floater); bounds.add(fBounds); } return bounds; }
protected void calcChildPaintingInfo( CssContext c, PaintingInfo result, boolean useCache) { for (int i = 0; i < getChildCount(); i++) { Box child = getChild(i); PaintingInfo info = child.calcPaintingInfo(c, useCache); moveIfGreater(result.getOuterMarginCorner(), info.getOuterMarginCorner()); result.getAggregateBounds().add(info.getAggregateBounds()); } }
protected void calcChildPaintingInfo( CssContext c, PaintingInfo result, boolean useCache) { for (int i = 0; i < getInlineChildCount(); i++) { Object obj = getInlineChild(i); if (obj instanceof Box) { PaintingInfo info = ((Box)obj).calcPaintingInfo(c, useCache); moveIfGreater(result.getOuterMarginCorner(), info.getOuterMarginCorner()); result.getAggregateBounds().add(info.getAggregateBounds()); } } }
protected void calcChildPaintingInfo( CssContext c, PaintingInfo result, boolean useCache) { for (int i = 0; i < getInlineChildCount(); i++) { Object obj = getInlineChild(i); if (obj instanceof Box) { PaintingInfo info = ((Box)obj).calcPaintingInfo(c, useCache); moveIfGreater(result.getOuterMarginCorner(), info.getOuterMarginCorner()); result.getAggregateBounds().add(info.getAggregateBounds()); } } }