Example usage for java.awt.geom Arc2D.Float setFrame

List of usage examples for java.awt.geom Arc2D.Float setFrame

Introduction

In this page you can find the example usage for java.awt.geom Arc2D.Float setFrame.

Prototype

public void setFrame(double x, double y, double w, double h) 

Source Link

Document

Note that the arc partially inscribes the framing rectangle of this RectangularShape .

Usage

From source file:MyCanvas.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    // Draw the pie chart
    Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE);
    arc.setFrame(140, 200, 67, 46);
    arc.setAngleStart(45);/*from   ww w  . ja  va  2 s . com*/
    arc.setAngleExtent(270);
    g2.setColor(Color.gray);
    g2.draw(arc);
    g2.setColor(Color.red);
    g2.fill(arc);
    g2.setColor(Color.black);
    g2.drawString("Arc2D.PIE", 140, 190);
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    //Draw the open arc 
    Arc2D.Float arc = new Arc2D.Float(Arc2D.OPEN);
    arc.setFrame(140, 100, 67, 46);
    arc.setAngleStart(45);/*  w w  w  . j a  va  2  s.co m*/
    arc.setAngleExtent(270);
    g2.setColor(Color.gray);
    g2.draw(arc);
    g2.setColor(Color.green);
    g2.fill(arc);
    g2.setColor(Color.black);
    g2.drawString("Arc2D.OPEN", 140, 90);
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    //Draw the chord

    Arc2D.Float arc1 = new Arc2D.Float(Arc2D.CHORD);
    arc1.setFrame(140, 30, 67, 46);
    arc1.setAngleStart(45);//  w  ww  .  j  a va  2  s  .co  m
    arc1.setAngleExtent(270);
    g2.setColor(Color.blue);
    g2.draw(arc1);
    g2.setColor(Color.gray);
    g2.fill(arc1);
    g2.setColor(Color.black);
    g2.drawString("Arc2D.CHORD", 140, 20);
}

From source file:MyCanvas.java

public void draw(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    // Draw the pie chart
    Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE);
    arc.setFrame(140, 200, 67, 46);
    arc.setAngleStart(45);/*from w  w  w. j a  va 2 s .  c  o m*/
    arc.setAngleExtent(270);
    g2.setColor(Color.gray);
    g2.draw(arc);
    g2.setColor(Color.red);
    g2.fill(arc);
    g2.setColor(Color.black);
    g2.drawString("Arc2D.PIE", 140, 190);
}