Package java.awt

Examples of java.awt.Graphics2D.drawOval()


          } else {
            // Draw a surrounding oval if no navigation panel icon is defined
            Graphics2D g2D = (Graphics2D)g;
            g2D.setColor(Color.BLACK);
            g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2D.drawOval(x + 3, y + 3, width - 6, height - 6);
          }
        }
 
        public Insets getBorderInsets(Component c) {
          return new Insets(2, 2, 2, 2);
View Full Code Here


            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

            GradientPaint gp = new GradientPaint(180.0f, 280.0f, new Color(255, 255, 255, 255), 250.0f, 380.0f, new Color(255, 255, 0, 0));
            g2.setPaint(gp);
            for(int i = 0; i < 3; i ++ ) {
                g2.drawOval(150, 280, 100, 100);
                g2.fillOval(150, 280, 100, 100);
                g2.translate(120, 20);
            }
        }
    }
View Full Code Here

    int x = randomInt(rng, 0, width / 2);
    int y = randomInt(rng, 0, height / 2);

    gfx.setXORMode(Color.BLACK);
    gfx.setStroke(new BasicStroke(randomInt(rng, fontSize / 8, fontSize / 2)));
    gfx.drawOval(x, y, dx, dy);

    WritableRaster rstr = image.getRaster();
    int[] vColor = new int[3];
    int[] oldColor = new int[3];
View Full Code Here

    int x = randomInt(rng, 0, width / 2);
    int y = randomInt(rng, 0, height / 2);

    gfx.setXORMode(Color.BLACK);
    gfx.setStroke(new BasicStroke(randomInt(rng, fontSize / 8, fontSize / 2)));
    gfx.drawOval(x, y, dx, dy);

    WritableRaster rstr = image.getRaster();
    int[] vColor = new int[3];
    int[] oldColor = new int[3];
View Full Code Here

            g.setColor(circleColor);
            for (int i = 0; i < circlesToDraw; i++) {
                int circleRadius = (int) (Math.random() * height / 2.0);
                int circleX = (int) (Math.random() * width - circleRadius);
                int circleY = (int) (Math.random() * height - circleRadius);
                g.drawOval(circleX, circleY, circleRadius * 2, circleRadius * 2);
            }
            g.setColor(textColor);
            g.setFont(textFont);

            FontMetrics fontMetrics = g.getFontMetrics();
View Full Code Here

            g.setColor(circleColor);
            for (int i = 0; i < circlesToDraw; i++) {
                int circleRadius = (int) (Math.random() * height / 2.0);
                int circleX = (int) (Math.random() * width - circleRadius);
                int circleY = (int) (Math.random() * height - circleRadius);
                g.drawOval(circleX, circleY, circleRadius * 2, circleRadius * 2);
            }
            g.setColor(textColor);
            g.setFont(textFont);

            FontMetrics fontMetrics = g.getFontMetrics();
View Full Code Here

                        Graphics2D g2 = (Graphics2D) g;
                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                        g2.setColor(c);
                        g2.fillOval(2, 2, 12, 12);
                        g2.setColor(Color.BLACK);
                        g2.drawOval(2, 2, 12, 12);
                    }

                    @Override
                    public int getIconWidth() {
                        return 16;
View Full Code Here

      g2.translate( x + 0.5f, y + 0.5f )// +0.5 = "smoother"
      g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
            g2.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
                    g2.setColor( color );
      g2.setStroke( strkOutside );
      g2.drawOval( 0, 0, 29, 29 );
      g2.setStroke( strkInside );
      g2.drawOval( 3, 3, 23, 23 );
      g2.draw( shpLine );

//      g2.translate( ctrlPt.getX(), ctrlPt.getY() );
View Full Code Here

            g2.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
                    g2.setColor( color );
      g2.setStroke( strkOutside );
      g2.drawOval( 0, 0, 29, 29 );
      g2.setStroke( strkInside );
      g2.drawOval( 3, 3, 23, 23 );
      g2.draw( shpLine );

//      g2.translate( ctrlPt.getX(), ctrlPt.getY() );
      g2.translate( ctrlPt.getX() - 0.5f, ctrlPt.getY() - 0.5f );
      g2.setPaint( pntCtrl );
View Full Code Here

    // Now draw pure blue text and a pure red oval
    ig.setColor(Color.yellow);
    ig.drawString("CPE22", 9, 22);
    ig.setColor(Color.red);
    ig.drawOval(1, 1, 62, 32);

    // Finally, scale the image by a factor of 10 and display it
    // in the window. This will allow us to see the anti-aliased pixels
    g.drawImage(image, AffineTransform.getScaleInstance(10, 10), this);
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.