public void draw(Graphics2D g2d) { close(); if (debug) { g2d.setColor(Color.GREEN); drawDebug(g2d); } g2d.setColor(Color.BLUE); final List<Point2D.Double> centers = new ArrayList<Point2D.Double>(); for (Line2D.Double l : lines) { centers.add(GeomUtils.getCenter(l)); } g2d.draw(new Line2D.Double(lines.get(0).getP1(), centers.get(0))); g2d.draw(new Line2D.Double(centers.get(centers.size() - 1), end)); for (int i = 0; i < lines.size() - 1; i++) { final Point2D c1 = centers.get(i); final Point2D c2 = centers.get(i + 1); final Point2D ctrl = lines.get(i).getP2(); assert ctrl.equals(lines.get(i + 1).getP1()); final QuadCurve2D.Double quad = new QuadCurve2D.Double(c1.getX(), c1.getY(), ctrl.getX(), ctrl.getY(), c2 .getX(), c2.getY()); g2d.draw(quad); } if (debug) { for (Point2D.Double c : centers) { GeomUtils.fillPoint2D(g2d, c); } } }
g2.draw(new Line2D.Double(lineStartX, lineStartY, lineEndX, lineEndY)); childStartX += cWidth; if (i < t.children().length - 1) {
case 0: g2d.fill(new Ellipse2D.Double(currX, currY, SHAPE_SIZE, SHAPE_SIZE)); break; case 1: g2d.fill(new Rectangle2D.Double(currX, currY, SHAPE_SIZE, SHAPE_SIZE)); break; case 2: g2d.fill(new Arc2D.Double(currX,currY,SHAPE_SIZE,SHAPE_SIZE,315,225,Arc2D.PIE)); break; case 3: g2d.setStroke(lineStroke); g2d.draw(new Line2D.Double(currX,currY,currX+SHAPE_SIZE,currY+SHAPE_SIZE)); break; default: break; case 3: g2d.setStroke(lineStroke); g2d.draw(new Line2D.Double(distractorX,distractorY,distractorX+SHAPE_SIZE,distractorY+SHAPE_SIZE)); break; default:
axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor); axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor); axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY()); axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY()); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(axisLine);
graphics.setPaint(fillPaint); Rectangle2D cellAnc = tc.getAnchor(); graphics.fill(cellAnc); continue; graphics.setStroke(getStroke(stroke)); Paint linePaint = drawPaint.getPaint(graphics, stroke.getPaint()); graphics.setPaint(linePaint); default: case bottom: line = new Line2D.Double(x-borderSize, y+h, x+w+borderSize, y+h); break; case left: line = new Line2D.Double(x, y, x, y+h+borderSize); break; case right: line = new Line2D.Double(x+w, y, x+w, y+h+borderSize); break; case top: line = new Line2D.Double(x-borderSize, y, x+w+borderSize, y); break; graphics.draw(line);
private void drawStraightLabelLine( java.awt.Shape outline, boolean drawingHalo, float thickness, float offset) { Rectangle2D bounds = outline.getBounds2D().getBounds(); double minX = bounds.getMinX(); double maxX = bounds.getMaxX(); if ((Math.abs(maxX - minX) < 0.0000001)) { // nothing to draw return; } // let's se if we are drawing the halo around the underline line if (drawingHalo) { // when drawing the halo we assume that the correct halo configuration has been set graphics.draw(new Line2D.Double(minX, offset, maxX, offset)); } else { // storing the current stroke and setting the stroke according to the specified // thickness Stroke currentStroke = graphics.getStroke(); graphics.setStroke(new BasicStroke(thickness)); // we draw a line with the same color of the text and a stroke of 2 graphics.draw(new Line2D.Double(minX, offset, maxX, offset)); // we need to restore the previous stroke graphics.setStroke(currentStroke); } }
gr.setColor(Color.LIGHT_GRAY); gr.setStroke(new BasicStroke(1, 0, 0, 1, new float[] {5, 5}, 0)); gr.draw(new Line2D.Double(0, 300, 600, 300)); gr.draw(new Line2D.Double(300, 0, 300, 600)); at.scale(10, -10); gr.setStroke(new BasicStroke(1)); gr.setColor(Color.LIGHT_GRAY); gr.draw(new LiteShape(boundsPoly, at, false)); gr.setStroke(new BasicStroke(0.5f)); gr.setColor(Color.BLUE); gr.draw(new LiteShape(original, at, false)); if (clipped instanceof Polygon || clipped instanceof MultiPolygon) { gr.setColor(Color.LIGHT_GRAY); gr.fill(new LiteShape(clipped, at, false)); gr.setColor(Color.BLUE);
lastY = y + coord[1]; } else if (type == USegmentType.SEG_LINETO) { final Shape line = new Line2D.Double(lastX, lastY, x + coord[0], y + coord[1]); drawShadow(g2d, line, shape.getDeltaShadow(), dpiFactor); lastX = x + coord[0]; (float) minMax.getMaxX(), (float) minMax.getMaxY(), mapper.getMappedColor(gr.getColor2())); g2d.setPaint(paint); g2d.fill(p); } else if (back != null) { g2d.setColor(mapper.getMappedColor(back)); g2d.fill(p); g2d.draw(p);
calculateEndOfPointer( circleCenterX, circleCenterY, pointerLength, pointerDirection); imageGraphic.setStroke(new java.awt.BasicStroke(3)); imageGraphic.setColor(pointerColor); imageGraphic.draw( new java.awt.geom.Line2D.Double( circleCenterX, circleCenterY, endPoint[0], endPoint[1])); imageGraphic.setStroke(new java.awt.BasicStroke(3)); imageGraphic.setColor(barColor); imageGraphic.draw( new java.awt.geom.Line2D.Double( circleCenterX, circleCenterY, circleCenterX, circleCenterY - barHeight));
protected void drawImage(Graphics2D g) { BufferedImage image = getBufferedImage(); if (image != null) { g.drawImage(image, (int) rectangle.x, (int) rectangle.y, (int) rectangle.width, (int) rectangle.height, null); } else { g.setStroke(new BasicStroke()); g.setColor(Color.red); g.draw(rectangle); g.draw(new Line2D.Double(rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height)); g.draw(new Line2D.Double(rectangle.x + rectangle.width, rectangle.y, rectangle.x, rectangle.y + rectangle.height)); } }
g.setStroke(styler.getAxisTickMarksStroke()); new Line2D.Double( xOffset, flippedTickLocation, xOffset + axisTickMarkLength, flippedTickLocation); g.draw(line); new Line2D.Double(lineXOffset, yOffset, lineXOffset, yOffset + yAxisBounds.getHeight()); g.draw(line); new Line2D.Double( shiftedTickLocation, yOffset, xOffset + tickLocation, yOffset - axisTickMarkLength); g.draw(line); g.setStroke(styler.getAxisTickMarksStroke()); g.drawLine( (int) xOffset,
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.gray); int x = 5; int y = 7; g2.draw(new Line2D.Double(x, y, 200, 200)); g2.drawString("Line2D", x, 250); }
private void draw(Graphics2D g, Node node) { Rectangle bounds = node.getBounds(); Rectangle2D r = new Rectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height); g.draw(r); ForceObject forceObject = node.getForceObject(); if (forceObject != null) { g.draw(new Line2D.Double(centerOfNode, centerOfForce)); g.draw(forceCenter); g.setColor(oldColor); Point p = forceObject.p; Ellipse2D circle = new Ellipse2D.Double(p.x - 2, p.y - 2, 4, 4); g.fill(circle); g.drawString(forceObject.getElement().toString(), (int) p.x + 4, (int) p.y - 4);
int y2 = getHeight(); Line2D line = new Line2D.Double(x1, y1, x2, y2); Rectangle2D rect = new Rectangle2D.Double(x, y, width, height); g2d.draw(rect); g2d.draw(line); for (Point2D p : ps) { if (p != null) { g2d.fill(new Ellipse2D.Double(p.getX() - 4, p.getY() - 4, 8, 8)); new Line2D.Double( rectangle.getX(), rectangle.getY(), new Line2D.Double( rectangle.getX(), rectangle.getY() + rectangle.getHeight(), new Line2D.Double( rectangle.getX(), rectangle.getY(), new Line2D.Double( rectangle.getX() + rectangle.getWidth(), rectangle.getY(),
public void drawSequenceflowWithoutArrow(int srcX, int srcY, int targetX, int targetY, boolean conditional, boolean highLighted) { Paint originalPaint = g.getPaint(); if (highLighted) g.setPaint(HIGHLIGHT_COLOR); Line2D.Double line = new Line2D.Double(srcX, srcY, targetX, targetY); g.draw(line); if (conditional) { drawConditionalSequenceFlowIndicator(line); } if (highLighted) g.setPaint(originalPaint); }
private static void drawDiamond(Graphics2D g, Point2D point, Point2D startOfLine, Point2D endOfLine, Color lineColor, Color interiorColor) { AffineTransform oldAf = g.getTransform(); AffineTransform tx = new AffineTransform(); Line2D.Double line = new Line2D.Double(startOfLine, endOfLine); tx.setToIdentity(); double angle = Math.atan2(line.y2 - line.y1, line.x2 - line.x1); tx.translate(point.getX(), point.getY()); // quarter rotation tx.rotate(angle - (Math.PI / 4)); AffineTransform gAf = g.getTransform(); gAf.concatenate(tx); g.setTransform(gAf); g.setColor(lineColor); g.fill(createSquareEnd()); g.setTransform(oldAf); }
/** * Draws an axis line at the current cursor position and edge. * * @param g2 the graphics device. * @param cursor the cursor position. * @param dataArea the data area. * @param edge the edge. */ protected void drawAxisLine(Graphics2D g2, double cursor, Rectangle2D dataArea, RectangleEdge edge) { Line2D axisLine = null; double x = dataArea.getX(); double y = dataArea.getY(); if (edge == RectangleEdge.TOP) { axisLine = new Line2D.Double(x, cursor, dataArea.getMaxX(), cursor); } else if (edge == RectangleEdge.BOTTOM) { axisLine = new Line2D.Double(x, cursor, dataArea.getMaxX(), cursor); } else if (edge == RectangleEdge.LEFT) { axisLine = new Line2D.Double(cursor, y, cursor, dataArea.getMaxY()); } else if (edge == RectangleEdge.RIGHT) { axisLine = new Line2D.Double(cursor, y, cursor, dataArea.getMaxY()); } g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); Object saved = g2.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL); g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); g2.draw(axisLine); g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, saved); }
double xMax = chart.getXAxis().getMax(); Line2D.Double line = new Line2D.Double(); Rectangle2D.Double rect = new Rectangle2D.Double(); && closeOffset != -Double.MAX_VALUE) { g.setColor(series.getLineColor()); g.setStroke(series.getLineStyle()); g.draw(line); final double xStart = xOffset - candleHalfWidth; final double xEnd = xOffset + candleHalfWidth; g.setPaint(series.getUpColor()); } else { g.setPaint(series.getDownColor()); xEnd - xStart, Math.abs(closeOffset - openOffset)); g.fill(rect); g.draw(line); line.setLine(xOffset, closeOffset, xEnd, closeOffset); g.draw(line); if (toolTipsEnabled) { rect.setRect(xStart, openOffset - lineWidth / 2, xOffset - xStart, lineWidth);
yCenter - Math.sin(Math.toRadians(angle)) * (pieBounds.getHeight() / endPoint); g.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); Shape line = new Line2D.Double(xOffsetStart, yOffsetStart, xOffsetEnd, yOffsetEnd); g.draw(line); g.fill(shape); g.setTransform(orig);
g2.setStroke(DRAWING_LINE_STROKE); if (mouseState == MouseState.DRAGGING && drawingLine != null) { g2.setColor(LINE_DRAWING_COLOR); g2.draw(drawingLine); Point2D p2d1 = new Point2D.Double(ellipses.get(0).getCenterX(), ellipses.get(0).getCenterY()); Point2D p2d2 = new Point2D.Double(ellipses.get(1).getCenterX(), ellipses.get(1).getCenterY()); Line2D line = new Line2D.Double(p2d1, p2d2); g2.draw(line); g2.setStroke(initStroke); return; drawingLine = new Line2D.Double(p1, e.getPoint()); repaint();