/******************************************************************************
* An Swing program that displays a pie graph
* Close the window, and kill the program by pressing ctrl-c                         
******************************************************************************/

import javax.swing.*;               //import all swing classes
import java.awt.*;                  //import all awt class

public class PieSwing extends JFrame        //this is a subclass of JFrame
{
    public static void main(String[] args)  
    {
        PieSwing frm = new PieSwing();      //create a new window

        frm.setTitle("Swing Pie Chart");    //set the title of window
        frm.setSize(300,200);               //set the size of window
        frm.setLocation(100,100);           //set the location of window
        frm.setVisible(true);               //set visibility on
    }

    public void paint(Graphics g)
    {
        g.setColor(Color.blue);             //change the color
        g.fillArc(25,30,100,100,45,315);    //fill a 3/4 arc
        g.setColor(Color.red);              //change the color
        g.fillArc(40,25,100,100,0,45);      //fill a 1/4 arc with offset
    }
}