RectangularShape rect = (RectangularShape) shape; if (!overwrite) { rect = (RectangularShape) rect.clone();
/** * Resizes a rectangle. This works for real rectangles and produces funny results for RoundRects etc .. * * @param rectangularShape * the rectangle * @param width * the new width of the rectangle * @param height * the new height of the rectangle. * @return the resized rectangle. */ public static Shape resizeRect( final RectangularShape rectangularShape, final double width, final double height ) { final RectangularShape retval = (RectangularShape) rectangularShape.clone(); retval.setFrame( retval.getX(), retval.getY(), width, height ); return retval; }
/** Completes the process of adding a Shape annotation and removed the transient paintable */ @SuppressWarnings("unchecked") public void mouseReleased(MouseEvent e) { VisualizationViewer<N, E> vv = (VisualizationViewer<N, E>) e.getSource(); if (e.isPopupTrigger()) { String annotationString = JOptionPane.showInputDialog(vv, "Annotation:"); if (annotationString != null && annotationString.length() > 0) { Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down); Annotation<String> annotation = new Annotation<String>(annotationString, layer, annotationColor, fill, p); annotationManager.add(layer, annotation); } } else if (e.getModifiers() == modifiers) { if (down != null) { Point2D out = e.getPoint(); RectangularShape arect = (RectangularShape) rectangularShape.clone(); arect.setFrameFromDiagonal(down, out); Shape s = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(arect); Annotation<Shape> annotation = new Annotation<>(s, layer, annotationColor, fill, out); annotationManager.add(layer, annotation); } } down = null; vv.removePostRenderPaintable(lensPaintable); vv.repaint(); }
if(down != null) { Point2D out = e.getPoint(); RectangularShape arect = (RectangularShape)rectangularShape.clone(); arect.setFrameFromDiagonal(down,out); Shape s = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(arect);
drawnShape = (RectangularShape) logicalShape.clone();
for (Iterator i = digraph.vertexIterator(); i.hasNext(); ) { Object vertex = i.next(); vertexShapeMap.put(vertex, shapePattern.clone()); if (root == null && digraph.incomingSize(vertex) == 0) root = vertex;
/** * Translates a se. Special care is taken to preserve the shape's original class, if the shape is a rectangle or a * line. * * @param s * the shape * @param x * the x coordinate where the shape is translated to * @param y * the y coordinate where the shape is translated to * @return the translated shape */ public static Shape translateShape( final Shape s, final double x, final double y ) { if ( s instanceof RectangularShape ) { final RectangularShape rect = (RectangularShape) s; final RectangularShape retval = (RectangularShape) rect.clone(); retval.setFrame( retval.getX() + x, retval.getY() + y, retval.getWidth(), retval.getHeight() ); return retval; } if ( s instanceof Line2D ) { final Line2D line = (Line2D) s; final Line2D retval = (Line2D) line.clone(); retval.setLine( retval.getX1() + x, retval.getY1() + y, retval.getX2() + x, retval.getY2() + y ); return retval; } final AffineTransform af = AffineTransform.getTranslateInstance( x, y ); return af.createTransformedShape( s ); }
Point copy = SwingUtilities.convertPoint(table, p, scrollPane); Rectangle visiblearea = (Rectangle) scrollPane.getVisibleRect() .clone(); visiblearea.x = mouseListener.getDivision(); if (!visiblearea.contains(copy)) {
(RectangularShape) entityArea.clone(), tip, url); entity.setIndex(k); entities.add(entity);
mapStart.put(comp, (Rectangle) comp.getBounds().clone());
RectangularShape rect = (RectangularShape) shape; if (!allowOverwrite) { rect = (RectangularShape) rect.clone();
RectangularShape rect = (RectangularShape) shape; if (!allowOverwrite) { rect = (RectangularShape) rect.clone();