Java Code Examples for java.awt.Graphics2D#rotate()

The following examples show how to use java.awt.Graphics2D#rotate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransformedPaintTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 10 votes vote down vote up
private void renderLine(PaintType type, Graphics2D g,
                        int startx, int starty, int w, int h)
{
    Paint p = createPaint(type, startx, starty, w, h);
    g.setPaint(p);

    // first, no transform
    g.fillRect(startx, starty, w, h);

    // translation only
    g.translate(w, 0);
    g.fillRect(startx, starty, w, h);
    g.translate(-w, 0);

    // complex transform
    g.translate(startx + w*2, starty);
    g.rotate(Math.toRadians(90), w/2, h/2);
    g.translate(-startx, -starty);
    g.fillRect(startx, starty, w, h);
}
 
Example 2
Source File: FlatMenuArrowIcon.java    From FlatLaf with Apache License 2.0 8 votes vote down vote up
@Override
protected void paintIcon( Component c, Graphics2D g ) {
	if( !c.getComponentOrientation().isLeftToRight() )
		g.rotate( Math.toRadians( 180 ), width / 2., height / 2. );

	g.setColor( getArrowColor( c ) );
	if( chevron ) {
		// chevron arrow
		Path2D path = FlatUIUtils.createPath( false, 1,1, 5,5, 1,9 );
		g.setStroke( new BasicStroke( 1f ) );
		g.draw( path );
	} else {
		// triangle arrow
		g.fill( FlatUIUtils.createPath( 0,0.5, 5,5, 0,9.5 ) );
	}
}
 
Example 3
Source File: DrawRotatedString.java    From dragonwell8_jdk with GNU General Public License v2.0 7 votes vote down vote up
private static BufferedImage createBufferedImage(final boolean  aa) {
    final BufferedImage bi = new BufferedImage(SIZE, SIZE,
                                               BufferedImage.TYPE_INT_RGB);
    final Graphics2D bg = bi.createGraphics();
    bg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        aa ? RenderingHints.VALUE_ANTIALIAS_ON
                           : RenderingHints.VALUE_ANTIALIAS_OFF);
    bg.setColor(Color.RED);
    bg.fillRect(0, 0, SIZE, SIZE);
    bg.translate(100, 100);
    bg.rotate(Math.toRadians(90));
    bg.setColor(Color.BLACK);
    bg.setFont(bg.getFont().deriveFont(20.0f));
    bg.drawString("MMMMMMMMMMMMMMMM", 0, 0);
    bg.dispose();
    return bi;
}
 
Example 4
Source File: TransformedPaintTest.java    From dragonwell8_jdk with GNU General Public License v2.0 7 votes vote down vote up
private void renderLine(PaintType type, Graphics2D g,
                        int startx, int starty, int w, int h)
{
    Paint p = createPaint(type, startx, starty, w, h);
    g.setPaint(p);

    // first, no transform
    g.fillRect(startx, starty, w, h);

    // translation only
    g.translate(w, 0);
    g.fillRect(startx, starty, w, h);
    g.translate(-w, 0);

    // complex transform
    g.translate(startx + w*2, starty);
    g.rotate(Math.toRadians(90), w/2, h/2);
    g.translate(-startx, -starty);
    g.fillRect(startx, starty, w, h);
}
 
Example 5
Source File: TransformedPaintTest.java    From TencentKona-8 with GNU General Public License v2.0 7 votes vote down vote up
private void renderLine(PaintType type, Graphics2D g,
                        int startx, int starty, int w, int h)
{
    Paint p = createPaint(type, startx, starty, w, h);
    g.setPaint(p);

    // first, no transform
    g.fillRect(startx, starty, w, h);

    // translation only
    g.translate(w, 0);
    g.fillRect(startx, starty, w, h);
    g.translate(-w, 0);

    // complex transform
    g.translate(startx + w*2, starty);
    g.rotate(Math.toRadians(90), w/2, h/2);
    g.translate(-startx, -starty);
    g.fillRect(startx, starty, w, h);
}
 
Example 6
Source File: TransformedPaintTest.java    From jdk8u_jdk with GNU General Public License v2.0 7 votes vote down vote up
private void renderLine(PaintType type, Graphics2D g,
                        int startx, int starty, int w, int h)
{
    Paint p = createPaint(type, startx, starty, w, h);
    g.setPaint(p);

    // first, no transform
    g.fillRect(startx, starty, w, h);

    // translation only
    g.translate(w, 0);
    g.fillRect(startx, starty, w, h);
    g.translate(-w, 0);

    // complex transform
    g.translate(startx + w*2, starty);
    g.rotate(Math.toRadians(90), w/2, h/2);
    g.translate(-startx, -starty);
    g.fillRect(startx, starty, w, h);
}
 
Example 7
Source File: AbstractRadial.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the image of the MinMeasuredValue and MaxMeasuredValue dependend
 * @param WIDTH
 * @param COLOR
 * @param ROTATION_OFFSET
 * @return the image of the min or max measured value
 */
protected BufferedImage create_MEASURED_VALUE_Image(final int WIDTH, final Color COLOR, final double ROTATION_OFFSET) {
    if (WIDTH <= 36) // 36 is needed otherwise the image size could be smaller than 1
    {
        return UTIL.createImage(1, 1, Transparency.TRANSLUCENT);
    }

    final int IMAGE_HEIGHT = (int) (WIDTH * 0.0280373832);
    final int IMAGE_WIDTH = IMAGE_HEIGHT;

    final BufferedImage IMAGE = UTIL.createImage(IMAGE_WIDTH, IMAGE_HEIGHT, Transparency.TRANSLUCENT);
    final Graphics2D G2 = IMAGE.createGraphics();
    G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    G2.rotate(ROTATION_OFFSET, IMAGE_WIDTH / 2.0, IMAGE_HEIGHT / 2.0);

    final GeneralPath INDICATOR = new GeneralPath();
    INDICATOR.setWindingRule(Path2D.WIND_EVEN_ODD);
    INDICATOR.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT);
    INDICATOR.lineTo(0.0, 0.0);
    INDICATOR.lineTo(IMAGE_WIDTH, 0.0);
    INDICATOR.closePath();

    G2.setColor(COLOR);
    G2.fill(INDICATOR);

    G2.dispose();

    return IMAGE;
}
 
Example 8
Source File: RotatedFontMetricsTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String ... args) {
    Font font = new Font(Font.DIALOG, Font.PLAIN, FONT_SIZE);
    Graphics2D g2d = createGraphics();

    FontMetrics ref = null;
    RuntimeException failure = null;
    for (int a = 0; a < 360; a += 15) {
        Graphics2D g = (Graphics2D)g2d.create();
        g.rotate(Math.toRadians(a));
        FontMetrics m = g.getFontMetrics(font);
        g.dispose();

        boolean status = true;
        if (ref == null) {
            ref = m;
        } else {
            status = ref.getAscent() == m.getAscent() &&
                    ref.getDescent() == m.getDescent() &&
                    ref.getLeading() == m.getLeading() &&
                    ref.getMaxAdvance() == m.getMaxAdvance();
        }

        System.out.printf("Metrics a%d, d%d, l%d, m%d (%d) %s\n",
                m.getAscent(), m.getDescent(), m.getLeading(), m.getMaxAdvance(),
                (int)a, status ? "OK" : "FAIL");

        if (!status && failure == null) {
            failure = new RuntimeException("Font metrics differ for angle " + a);
        }
    }
    if (failure != null) {
        throw failure;
    }
    System.out.println("done");
}
 
Example 9
Source File: PgramUserBoundsTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void testAll(Graphics2D g2d) {
    g2d.setTransform(identity);
    g2d.translate(100, 100);
    testPrimitives(g2d);

    g2d.setTransform(identity);
    g2d.scale(10, 10);
    testPrimitives(g2d);

    g2d.setTransform(identity);
    g2d.rotate(Math.PI/6);
    testPrimitives(g2d);
}
 
Example 10
Source File: IncorrectUnmanagedImageRotatedClip.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void draw(final BufferedImage from,final Image to) {
    final Graphics2D g2d = (Graphics2D) to.getGraphics();
    g2d.setComposite(AlphaComposite.Src);
    g2d.setColor(Color.ORANGE);
    g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null));
    g2d.rotate(Math.toRadians(45));
    g2d.clip(new Rectangle(41, 42, 43, 44));
    g2d.drawImage(from, 50, 50, Color.blue, null);
    g2d.dispose();
}
 
Example 11
Source File: PDFRenderer.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
private void transform(Graphics2D graphics, PDPage page, float scaleX, float scaleY)
{
    graphics.scale(scaleX, scaleY);

    // TODO should we be passing the scale to PageDrawer rather than messing with Graphics?
    int rotationAngle = page.getRotation();
    PDRectangle cropBox = page.getCropBox();

    if (rotationAngle != 0)
    {
        float translateX = 0;
        float translateY = 0;
        switch (rotationAngle)
        {
            case 90:
                translateX = cropBox.getHeight();
                break;
            case 270:
                translateY = cropBox.getWidth();
                break;
            case 180:
                translateX = cropBox.getWidth();
                translateY = cropBox.getHeight();
                break;
            default:
                break;
        }
        graphics.translate(translateX, translateY);
        graphics.rotate(Math.toRadians(rotationAngle));
    }
}
 
Example 12
Source File: RotatedFontMetricsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String ... args) {
    Font font = new Font(Font.DIALOG, Font.PLAIN, FONT_SIZE);
    Graphics2D g2d = createGraphics();

    FontMetrics ref = null;
    RuntimeException failure = null;
    for (int a = 0; a < 360; a += 15) {
        Graphics2D g = (Graphics2D)g2d.create();
        g.rotate(Math.toRadians(a));
        FontMetrics m = g.getFontMetrics(font);
        g.dispose();

        boolean status = true;
        if (ref == null) {
            ref = m;
        } else {
            status = ref.getAscent() == m.getAscent() &&
                    ref.getDescent() == m.getDescent() &&
                    ref.getLeading() == m.getLeading() &&
                    ref.getMaxAdvance() == m.getMaxAdvance();
        }

        System.out.printf("Metrics a%d, d%d, l%d, m%d (%d) %s\n",
                m.getAscent(), m.getDescent(), m.getLeading(), m.getMaxAdvance(),
                (int)a, status ? "OK" : "FAIL");

        if (!status && failure == null) {
            failure = new RuntimeException("Font metrics differ for angle " + a);
        }
    }
    if (failure != null) {
        throw failure;
    }
    System.out.println("done");
}
 
Example 13
Source File: PgramUserBoundsTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static void testAll(Graphics2D g2d) {
    g2d.setTransform(identity);
    g2d.translate(100, 100);
    testPrimitives(g2d);

    g2d.setTransform(identity);
    g2d.scale(10, 10);
    testPrimitives(g2d);

    g2d.setTransform(identity);
    g2d.rotate(Math.PI/6);
    testPrimitives(g2d);
}
 
Example 14
Source File: LabelMapLayer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void displayLayer(
	Graphics2D g2d, Settlement settlement, Building building,
	double xPos, double yPos, int mapWidth, int mapHeight,
	double rotation, double scale
) {

	// Save original graphics transforms.
	AffineTransform saveTransform = g2d.getTransform();

	// Get the map center point.
	double mapCenterX = mapWidth / 2D;
	double mapCenterY = mapHeight / 2D;

	// Translate map from settlement center point.
	g2d.translate(mapCenterX + (xPos * scale), mapCenterY + (yPos * scale));

	// Rotate map from North.
	g2d.rotate(rotation, 0D - (xPos * scale), 0D - (yPos * scale));

	// Draw all building labels.
	if (mapPanel.isShowBuildingLabels()) {
		//mapPanel.getSettlementTransparentPanel().getBuildingLabelMenuItem().setState(true);
		drawBuildingLabels(g2d, settlement);
	}

	// Draw all construction site labels.
	if (mapPanel.isShowConstructionLabels()) {
		drawConstructionSiteLabels(g2d, settlement);
	}

	// Draw all vehicle labels.
	if (mapPanel.isShowVehicleLabels()) {
		drawVehicleLabels(g2d, settlement);
	}

	// Draw all people labels.
	drawPersonLabels(g2d, settlement, mapPanel.isShowPersonLabels());

	// Draw all people labels.
	drawRobotLabels(g2d, settlement, mapPanel.isShowRobotLabels());

	// Restore original graphic transforms.
	g2d.setTransform(saveTransform);
}
 
Example 15
Source File: CSSBorder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g,
                                    int x, int y, int width, int height) {
    if (!(g instanceof Graphics2D)) {
        return;
    }

    Graphics2D g2 = (Graphics2D) g.create();

    int[] widths = getWidths();

    // Position and size of the border interior.
    int intX = x + widths[LEFT];
    int intY = y + widths[TOP];
    int intWidth = width - (widths[RIGHT] + widths[LEFT]);
    int intHeight = height - (widths[TOP] + widths[BOTTOM]);

    // Coordinates of the interior corners, from NW clockwise.
    int[][] intCorners = {
        { intX, intY },
        { intX + intWidth, intY },
        { intX + intWidth, intY + intHeight },
        { intX, intY + intHeight, },
    };

    // Draw the borders for all sides.
    for (int i = 0; i < 4; i++) {
        Value style = getBorderStyle(i);
        Polygon shape = getBorderShape(i);
        if ((style != Value.NONE) && (shape != null)) {
            int sideLength = (i % 2 == 0 ? intWidth : intHeight);

            // "stretch" the border shape by the interior area dimension
            shape.xpoints[2] += sideLength;
            shape.xpoints[3] += sideLength;
            Color color = getBorderColor(i);
            BorderPainter painter = getBorderPainter(i);

            double angle = i * Math.PI / 2;
            g2.setClip(g.getClip()); // Restore initial clip
            g2.translate(intCorners[i][0], intCorners[i][1]);
            g2.rotate(angle);
            g2.clip(shape);
            painter.paint(shape, g2, color, i);
            g2.rotate(-angle);
            g2.translate(-intCorners[i][0], -intCorners[i][1]);
        }
    }
    g2.dispose();
}
 
Example 16
Source File: DiagramConnectionWidget.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = this.getGraphics();

    if (xPoints.length == 0 || Math.abs(xPoints[0] - xPoints[xPoints.length - 1]) > 2000) {
        return;
    }

    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    //g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    //g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    DiagramScene ds = (DiagramScene) this.getScene();
    boolean shouldHide = false;//ds.getShouldHide(this);

    Composite oldComposite = null;
    if (shouldHide) {
        Color c = new Color(255 - (255 - color.getRed()) / WHITE_FACTOR, 255 - (255 - color.getGreen()) / WHITE_FACTOR, 255 - (255 - color.getBlue()) / WHITE_FACTOR);
        g.setPaint(c);
    } else {
        g.setPaint(color);
    }

    if (split) {
        for (int i = 1; i < controlPoints.size(); i++) {
            Point prev = controlPoints.get(i - 1);
            Point cur = controlPoints.get(i);
            if (cur == null || prev == null) {
                continue;
            }

            g.drawLine(prev.x, prev.y, cur.x, cur.y);
        }
    } else {
        g.drawPolyline(xPoints, yPoints, pointCount);
    }

    /*for(int i=0; i<xPoints.length; i++) {
    int x = xPoints[i];
    int y = yPoints[i];
    g.fillOval(x - 2, y - 2, 4, 4);
    }*/

    if (xPoints.length >= 2) {
        Graphics2D g2 = (Graphics2D) g.create();
        int xOff = xPoints[xPoints.length - 2] - xPoints[xPoints.length - 1];
        int yOff = yPoints[yPoints.length - 2] - yPoints[yPoints.length - 1];
        if (xOff == 0 && yOff == 0 && yPoints.length >= 3) {
            xOff = xPoints[xPoints.length - 3] - xPoints[xPoints.length - 1];
            yOff = yPoints[yPoints.length - 3] - yPoints[yPoints.length - 1];
        }
        g2.translate(xPoints[xPoints.length - 1], yPoints[yPoints.length - 1]);
        g2.rotate(Math.atan2(yOff, xOff));

        g2.scale(0.55, 0.80);
        AnchorShape.TRIANGLE_FILLED.paint(g2, false);
    }
}
 
Example 17
Source File: CSSBorder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g,
                                    int x, int y, int width, int height) {
    if (!(g instanceof Graphics2D)) {
        return;
    }

    Graphics2D g2 = (Graphics2D) g.create();

    int[] widths = getWidths();

    // Position and size of the border interior.
    int intX = x + widths[LEFT];
    int intY = y + widths[TOP];
    int intWidth = width - (widths[RIGHT] + widths[LEFT]);
    int intHeight = height - (widths[TOP] + widths[BOTTOM]);

    // Coordinates of the interior corners, from NW clockwise.
    int[][] intCorners = {
        { intX, intY },
        { intX + intWidth, intY },
        { intX + intWidth, intY + intHeight },
        { intX, intY + intHeight, },
    };

    // Draw the borders for all sides.
    for (int i = 0; i < 4; i++) {
        Value style = getBorderStyle(i);
        Polygon shape = getBorderShape(i);
        if ((style != Value.NONE) && (shape != null)) {
            int sideLength = (i % 2 == 0 ? intWidth : intHeight);

            // "stretch" the border shape by the interior area dimension
            shape.xpoints[2] += sideLength;
            shape.xpoints[3] += sideLength;
            Color color = getBorderColor(i);
            BorderPainter painter = getBorderPainter(i);

            double angle = i * Math.PI / 2;
            g2.setClip(g.getClip()); // Restore initial clip
            g2.translate(intCorners[i][0], intCorners[i][1]);
            g2.rotate(angle);
            g2.clip(shape);
            painter.paint(shape, g2, color, i);
            g2.rotate(-angle);
            g2.translate(-intCorners[i][0], -intCorners[i][1]);
        }
    }
    g2.dispose();
}
 
Example 18
Source File: AbstractTtlGate.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
protected void paintBase(InstancePainter painter, boolean drawname, boolean ghost) {
	Direction dir = painter.getAttributeValue(StdAttr.FACING);
	Graphics2D g = (Graphics2D) painter.getGraphics();
	Bounds bds = painter.getBounds();
	int x = bds.getX();
	int y = bds.getY();
	int xp = x, yp = y;
	int width = bds.getWidth();
	int height = bds.getHeight();
	for (byte i = 0; i < this.pinnumber; i++) {
		if (i < this.pinnumber / 2) {
			if (dir == Direction.WEST || dir == Direction.EAST)
				xp = i * 20 + (10 - pinwidth / 2) + x;
			else
				yp = i * 20 + (10 - pinwidth / 2) + y;
		} else {
			if (dir == Direction.WEST || dir == Direction.EAST) {
				xp = (i - this.pinnumber / 2) * 20 + (10 - pinwidth / 2) + x;
				yp = height + y - pinheight;
			} else {
				yp = (i - this.pinnumber / 2) * 20 + (10 - pinwidth / 2) + y;
				xp = width + x - pinheight;
			}
		}
		if (dir == Direction.WEST || dir == Direction.EAST) {
			// fill the background of white if selected from preferences
			if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
				g.setColor(Color.WHITE);
				g.fillRect(xp, yp, pinwidth, pinheight);
				g.setColor(Color.BLACK);
			}
			g.drawRect(xp, yp, pinwidth, pinheight);
		} else {
			// fill the background of white if selected from preferences
			if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
				g.setColor(Color.WHITE);
				g.fillRect(xp, yp, pinheight, pinwidth);
				g.setColor(Color.BLACK);
			}
			g.drawRect(xp, yp, pinheight, pinwidth);
		}
	}
	if (dir == Direction.SOUTH) {
		// fill the background of white if selected from preferences
		if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
			g.setColor(Color.WHITE);
			g.fillRoundRect(x + pinheight, y, bds.getWidth() - pinheight * 2, bds.getHeight(), 10, 10);
			g.setColor(Color.BLACK);
		}
		g.drawRoundRect(x + pinheight, y, bds.getWidth() - pinheight * 2, bds.getHeight(), 10, 10);
		g.drawArc(x + width / 2 - 7, y - 7, 14, 14, 180, 180);
	} else if (dir == Direction.WEST) {
		// fill the background of white if selected from preferences
		if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
			g.setColor(Color.WHITE);
			g.fillRoundRect(x, y + pinheight, bds.getWidth(), bds.getHeight() - pinheight * 2, 10, 10);
			g.setColor(Color.BLACK);
		}
		g.drawRoundRect(x, y + pinheight, bds.getWidth(), bds.getHeight() - pinheight * 2, 10, 10);
		g.drawArc(x + width - 7, y + height / 2 - 7, 14, 14, 90, 180);
	} else if (dir == Direction.NORTH) {
		// fill the background of white if selected from preferences
		if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
			g.setColor(Color.WHITE);
			g.fillRoundRect(x + pinheight, y, bds.getWidth() - pinheight * 2, bds.getHeight(), 10, 10);
			g.setColor(Color.BLACK);
		}
		g.drawRoundRect(x + pinheight, y, bds.getWidth() - pinheight * 2, bds.getHeight(), 10, 10);
		g.drawArc(x + width / 2 - 7, y + height - 7, 14, 14, 0, 180);
	} else {// east
		// fill the background of white if selected from preferences
		if (!ghost && AppPreferences.FILL_COMPONENT_BACKGROUND.getBoolean()) {
			g.setColor(Color.WHITE);
			g.fillRoundRect(x, y + pinheight, bds.getWidth(), bds.getHeight() - pinheight * 2, 10, 10);
			g.setColor(Color.BLACK);
		}
		g.drawRoundRect(x, y + pinheight, bds.getWidth(), bds.getHeight() - pinheight * 2, 10, 10);
		g.drawArc(x - 7, y + height / 2 - 7, 14, 14, 270, 180);
	}
	g.rotate(Math.toRadians(-dir.toDegrees()), x + width / 2, y + height / 2);
	if (drawname) {
		g.setFont(new Font(Font.DIALOG_INPUT, Font.BOLD, 14));
		GraphicsUtil.drawCenteredText(g, this.name, x + bds.getWidth() / 2, y + bds.getHeight() / 2 - 4);
	}
	if (dir == Direction.WEST || dir == Direction.EAST) {
		xp = x;
		yp = y;
	} else {
		xp = x + (width - height) / 2;
		yp = y + (height - width) / 2;
		width = bds.getHeight();
		height = bds.getWidth();
	}
	g.setFont(new Font(Font.DIALOG_INPUT, Font.BOLD, 7));
	GraphicsUtil.drawCenteredText(g, "Vcc", xp + 10, yp + pinheight + 4);
	GraphicsUtil.drawCenteredText(g, "GND", xp + width - 10, yp + height - pinheight - 7);
}
 
Example 19
Source File: FlatTreeExpandedIcon.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
@Override
void rotate( Component c, Graphics2D g ) {
	g.rotate( Math.toRadians( 90 ), width / 2., height / 2. );
}
 
Example 20
Source File: FlatTreeCollapsedIcon.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
void rotate( Component c, Graphics2D g ) {
	if( !c.getComponentOrientation().isLeftToRight() )
		g.rotate( Math.toRadians( 180 ), width / 2., height / 2. );
}