Package java.awt

Examples of java.awt.Graphics2D.rotate()


    if (!isValid()) super.validate();
    Graphics2D g2d = (Graphics2D)g;
    if (tappedAngle > 0) {
      g2d = (Graphics2D)g2d.create();
      float edgeOffset = cardWidth / 2f;
      g2d.rotate(tappedAngle, cardXOffset + edgeOffset, cardYOffset + cardHeight - edgeOffset);
    }
    super.paint(g2d);
  }

  protected void paintComponent (Graphics g) {
View Full Code Here


                case VERTICAL: {
                    dataRenderer.setSize(Math.max(getHeight() - (buttonPadding.top + buttonPadding.bottom + 2), 0),
                        Math.max(getWidth() - (buttonPadding.left + buttonPadding.right + 2), 0));

                    contentGraphics.translate(buttonPadding.top + 1, buttonPadding.left + 1);
                    contentGraphics.rotate(-Math.PI / 2d);
                    contentGraphics.translate(-dataRenderer.getWidth(), 0);
                    break;
                }
            }
View Full Code Here

    float bendPercent = (float)Math.asin(ey / length);
    if (endX > startX) bendPercent = -bendPercent;
    Area arrow = getArrow(length, bendPercent);
    Graphics2D g2d = (Graphics2D)g;
    g2d.translate(startX, startY);
    g2d.rotate(Math.atan2(ey, ex));
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setComposite(composite);
    g2d.setColor(this.color);
    g2d.fill(arrow);
    g2d.setColor(Color.BLACK);
View Full Code Here

            g.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.5f ) );

            g.translate( cx+translateX, cy+translateY );
            g.scale( 1.0001+scale, 1.0001+scale )// The .0001 works round a bug on Windows where drawImage throws an ArrayIndexOutofBoundException
            if ( rotation != 0 )
                g.rotate( rotate );
            g.translate( -cx, -cy );

            g.drawImage( dst, null, null );
            g.dispose();
            BufferedImage ti = dst;
View Full Code Here

                    break;
                default:
                    break;
            }
            graphics.translate(translateX,translateY);
            graphics.rotate((float)Math.toRadians(rotationAngle));
        }
        graphics.scale( scaling, scaling );
        PageDrawer drawer = new PageDrawer();
        drawer.drawPage( graphics, this, pageDimension );
View Full Code Here

                        default:
                                break;
                }
                if (isStringPainted()) {
                        if (getOrientation() == VERTICAL) {
                                g2.rotate(-Math.PI * 3.0 / 2.0, str_x, str_y);
                                g2.drawString(getString(), str_x, str_y);
                                g2.rotate(Math.PI * 3.0 / 2.0, str_x, str_y);
                        } else {
                                g2.drawString(getString(), str_x, str_y);
                        }
View Full Code Here

                }
                if (isStringPainted()) {
                        if (getOrientation() == VERTICAL) {
                                g2.rotate(-Math.PI * 3.0 / 2.0, str_x, str_y);
                                g2.drawString(getString(), str_x, str_y);
                                g2.rotate(Math.PI * 3.0 / 2.0, str_x, str_y);
                        } else {
                                g2.drawString(getString(), str_x, str_y);
                        }
                }
                if (isBorderPainted()) {
View Full Code Here

        for (int i = 0; i < c; i++) {
            float f = ((i + 1) / (float)c);
            Color col = new Color(0.0f, 1 - f, 0.0f);
            copy.setColor(col);
            copy.fillRect(70, 90, 50, 50);
            copy.rotate(-2 * Math.PI / c, 70, 90);
        }
        copy.dispose();

        //Some text
        g2d.rotate(-0.25);
View Full Code Here

        for (int i = 0; i < c; i++) {
            float f = ((i + 1) / (float)c);
            Color col = new Color(0.0f, 1 - f, 0.0f);
            copy.setColor(col);
            copy.fillRect(0, 0, 120, 120);
            copy.rotate(-2 * Math.PI / c);
        }
        copy.dispose();

        //the same in gray scales
        copy = (Graphics2D)g2d.create();
View Full Code Here

        for (int i = 0; i < c; i++) {
            float f = ((i + 1) / (float)c);
            Color col = new Color(f, f, f);
            copy.setColor(col);
            copy.fillRect(0, 0, 120, 120);
            copy.rotate(-2 * Math.PI / c);
        }
        copy.dispose();
        return buf;
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.