Search in sources :

Example 1 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project screenbird by adamhub.

the class JRoundBorderSB method paintBorder.

@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    int r = height - 1;
    RoundRectangle2D round = new RoundRectangle2D.Float(x, y, width - 1, height - 1, r, r);
    Container parent = c.getParent();
    if (parent != null) {
        g2.setColor(parent.getBackground());
        Area corner = new Area(new Rectangle2D.Float(x, y, width, height));
        corner.subtract(new Area(round));
        g2.fill(corner);
    }
    g2.setColor(Color.lightGray);
    g2.draw(round);
    g2.dispose();
}
Also used : Container(java.awt.Container) Area(java.awt.geom.Area) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Rectangle2D(java.awt.geom.Rectangle2D) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Graphics2D(java.awt.Graphics2D)

Example 2 with RoundRectangle2D

use of java.awt.geom.RoundRectangle2D in project Activiti by Activiti.

the class DefaultProcessDiagramCanvas method drawExpandedSubProcess.

public void drawExpandedSubProcess(String name, GraphicInfo graphicInfo, Boolean isTriggeredByEvent, double scaleFactor) {
    RoundRectangle2D rect = new RoundRectangle2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight(), 8, 8);
    // Use different stroke (dashed)
    if (isTriggeredByEvent) {
        Stroke originalStroke = g.getStroke();
        g.setStroke(EVENT_SUBPROCESS_STROKE);
        g.draw(rect);
        g.setStroke(originalStroke);
    } else {
        Paint originalPaint = g.getPaint();
        g.setPaint(SUBPROCESS_BOX_COLOR);
        g.fill(rect);
        g.setPaint(SUBPROCESS_BORDER_COLOR);
        g.draw(rect);
        g.setPaint(originalPaint);
    }
    if (scaleFactor == 1.0 && name != null && !name.isEmpty()) {
        String text = fitTextToWidth(name, (int) graphicInfo.getWidth());
        g.drawString(text, (int) graphicInfo.getX() + 10, (int) graphicInfo.getY() + 15);
    }
}
Also used : Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Paint(java.awt.Paint) AttributedString(java.text.AttributedString)

Example 3 with RoundRectangle2D

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

the class PPGraphics2D method fillRoundRect.

/**
     * Fills the specified rounded corner rectangle with the current color.
     * The left and right edges of the rectangle
     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>,
     * respectively. The top and bottom edges of the rectangle are at
     * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
     * @param       x the <i>x</i> coordinate of the rectangle to be filled.
     * @param       y the <i>y</i> coordinate of the rectangle to be filled.
     * @param       width the width of the rectangle to be filled.
     * @param       height the height of the rectangle to be filled.
     * @param       arcWidth the horizontal diameter
     *                     of the arc at the four corners.
     * @param       arcHeight the vertical diameter
     *                     of the arc at the four corners.
     * @see         java.awt.Graphics#drawRoundRect
     */
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
    RoundRectangle2D rect = new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight);
    fill(rect);
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D)

Example 4 with RoundRectangle2D

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

the class PPGraphics2D method drawRoundRect.

/**
     * Draws an outlined round-cornered rectangle using this graphics
     * context's current color. The left and right edges of the rectangle
     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,
     * respectively. The top and bottom edges of the rectangle are at
     * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
     * @param      x the <i>x</i> coordinate of the rectangle to be drawn.
     * @param      y the <i>y</i> coordinate of the rectangle to be drawn.
     * @param      width the width of the rectangle to be drawn.
     * @param      height the height of the rectangle to be drawn.
     * @param      arcWidth the horizontal diameter of the arc
     *                    at the four corners.
     * @param      arcHeight the vertical diameter of the arc
     *                    at the four corners.
     * @see        java.awt.Graphics#fillRoundRect
     */
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
    RoundRectangle2D rect = new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight);
    draw(rect);
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D)

Example 5 with RoundRectangle2D

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

the class SLGraphics method drawRoundRect.

/**
     * Draws an outlined round-cornered rectangle using this graphics
     * context's current color. The left and right edges of the rectangle
     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,
     * respectively. The top and bottom edges of the rectangle are at
     * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
     * @param      x the <i>x</i> coordinate of the rectangle to be drawn.
     * @param      y the <i>y</i> coordinate of the rectangle to be drawn.
     * @param      width the width of the rectangle to be drawn.
     * @param      height the height of the rectangle to be drawn.
     * @param      arcWidth the horizontal diameter of the arc
     *                    at the four corners.
     * @param      arcHeight the vertical diameter of the arc
     *                    at the four corners.
     * @see        java.awt.Graphics#fillRoundRect
     */
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
    RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcWidth, arcHeight);
    draw(rect);
}
Also used : RoundRectangle2D(java.awt.geom.RoundRectangle2D)

Aggregations

RoundRectangle2D (java.awt.geom.RoundRectangle2D)35 Color (java.awt.Color)12 Graphics2D (java.awt.Graphics2D)11 BasicStroke (java.awt.BasicStroke)9 Paint (java.awt.Paint)9 Stroke (java.awt.Stroke)9 GradientPaint (java.awt.GradientPaint)6 RadialGradientPaint (java.awt.RadialGradientPaint)5 Point (java.awt.Point)4 Rectangle (java.awt.Rectangle)4 Area (java.awt.geom.Area)4 Ellipse2D (java.awt.geom.Ellipse2D)4 Line2D (java.awt.geom.Line2D)4 RbmModelContainer (cbit.vcell.model.Model.RbmModelContainer)3 Point2D (java.awt.geom.Point2D)3 Rectangle2D (java.awt.geom.Rectangle2D)3 MolecularType (org.vcell.model.rbm.MolecularType)3 Font (java.awt.Font)2 Graphics (java.awt.Graphics)2 AttributedString (java.text.AttributedString)2