Search in sources :

Example 36 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project archi by archimatetool.

the class GraphicsToGraphics2DAdaptor method fillRoundRectangle.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.draw2d.Graphics#fillRoundRectangle(org.eclipse.draw2d.geometry
     * .Rectangle, int, int)
     */
@Override
public void fillRoundRectangle(Rectangle rect, int arcWidth, int arcHeight) {
    RoundRectangle2D roundRect = new RoundRectangle2D.Float(rect.x + transX, rect.y + transY, rect.width, rect.height, arcWidth, arcHeight);
    checkState();
    getGraphics2D().setPaint(getColor(swtGraphics.getBackgroundColor()));
    getGraphics2D().fill(roundRect);
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D)

Example 37 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project airavata by apache.

the class NodeGUI method getComponentShape.

protected Shape getComponentShape() {
    Point position = getNode().getPosition();
    RoundRectangle2D completeComponentBoundaryRect = new RoundRectangle2D.Float(position.x, position.y, this.dimension.width, this.dimension.height, DrawUtils.ARC_SIZE, DrawUtils.ARC_SIZE);
    return completeComponentBoundaryRect;
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D) Point(java.awt.Point)

Example 38 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project airavata by apache.

the class NodeGUI method getComponentHeaderShape.

protected Shape getComponentHeaderShape() {
    Point position = getNode().getPosition();
    RoundRectangle2D headerBoundaryRect = new RoundRectangle2D.Double(position.x, position.y, this.dimension.width, this.headHeight, DrawUtils.ARC_SIZE, DrawUtils.ARC_SIZE);
    return headerBoundaryRect;
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D) Point(java.awt.Point)

Example 39 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project pool by Maharramoff.

the class Game method tableRender.

private void tableRender(Graphics2D graphics2D) {
    // Borders
    RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, Helper.SW, Helper.SH, 30, 30);
    graphics2D.setColor(Helper.BC);
    graphics2D.fill(roundedRectangle);
    // Table
    graphics2D.setColor(Helper.TC);
    graphics2D.fillRect(Helper.TB, Helper.TB, Helper.SW - Helper.TB * 2, Helper.SH - Helper.TB * 2);
    // Table white line and dot
    graphics2D.setColor(Helper.BALL_WHITE);
    graphics2D.drawLine(Helper.SW - Helper.SW / 4, Helper.TB, Helper.SW - Helper.SW / 4, Helper.SH - Helper.TB);
    graphics2D.drawOval(Helper.SW / 4, Helper.SH / 2, 2, 2);
    // Holes
    Helper.HOLES.forEach((String key, int[] value) -> {
        graphics2D.setColor(Color.BLACK);
        graphics2D.fillOval(Helper.HOLES.get(key)[0], Helper.HOLES.get(key)[1], Helper.HR * 2, Helper.HR * 2);
        // Hole arcs
        graphics2D.setColor(Helper.HAC);
        graphics2D.setStroke(new BasicStroke(2));
        graphics2D.drawArc(Helper.HOLES.get(key)[0], Helper.HOLES.get(key)[1], Helper.HR * 2, Helper.HR * 2, Helper.ARCS.get(key)[0], Helper.ARCS.get(key)[1]);
    });
    reDrawBalls(graphics2D);
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D)

Example 40 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project TrakEM2 by trakem2.

the class Node method paintTags.

private void paintTags(final Graphics2D g, final int x, final int y, Color background_color) {
    final int ox = x + 20;
    int oy = y + 20;
    Color fontcolor = Color.blue;
    if (Color.red == background_color || Color.blue == background_color)
        fontcolor = Color.white;
    else
        background_color = Taggable.TAG_BACKGROUND;
    // so the Color indicated in the parameter background_color is used only as a flag
    final Stroke stroke = g.getStroke();
    g.setStroke(Taggable.DASHED_STROKE);
    g.setColor(background_color);
    g.drawLine(x, y, ox, oy);
    g.setStroke(stroke);
    final Tag[] tags = this.tags instanceof Tag[] ? (Tag[]) this.tags : new Tag[] { (Tag) this.tags };
    for (final Tag ob : tags) {
        final String tag = ob.toString();
        final Dimension dim = Utils.getDimensions(tag, g.getFont());
        final int arc = (int) (dim.height / 3.0f);
        final RoundRectangle2D rr = new RoundRectangle2D.Float(ox, oy, dim.width + 4, dim.height + 2, arc, arc);
        g.setColor(background_color);
        g.fill(rr);
        g.setColor(fontcolor);
        g.drawString(tag, ox + 2, oy + dim.height - 1);
        oy += dim.height + 3;
    }
}
Also used : Stroke(java.awt.Stroke) Color(java.awt.Color) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Dimension(java.awt.Dimension)

Aggregations

RoundRectangle2D (java.awt.geom.RoundRectangle2D)45 Color (java.awt.Color)14 Graphics2D (java.awt.Graphics2D)13 Paint (java.awt.Paint)12 BasicStroke (java.awt.BasicStroke)11 Stroke (java.awt.Stroke)10 GradientPaint (java.awt.GradientPaint)8 Ellipse2D (java.awt.geom.Ellipse2D)8 Area (java.awt.geom.Area)7 Rectangle2D (java.awt.geom.Rectangle2D)7 Line2D (java.awt.geom.Line2D)6 RadialGradientPaint (java.awt.RadialGradientPaint)5 Rectangle (java.awt.Rectangle)5 Point (java.awt.Point)4 RbmModelContainer (cbit.vcell.model.Model.RbmModelContainer)3 FontMetrics (java.awt.FontMetrics)3 Arc2D (java.awt.geom.Arc2D)3 Point2D (java.awt.geom.Point2D)3 MolecularType (org.vcell.model.rbm.MolecularType)3 Font (java.awt.Font)2