can you give me some direction ?

I am moving along slowly but surly on the code, I need to slice up the Circle on the Pane into 3-4 slices, each with its own color, can you give me some direction ?


class Graph extends JFrame {
     public Graph() {
    super("PIE CHART");
    setSize(500, 500);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
    Container pane = getContentPane();
     pane.add(new Circle());
     setContentPane(pane);
     setVisible(true);
 }
}

class Circle extends JPanel {
     public void paintComponent(Graphics g) {
Graphics cir = (Graphics) g;
cir.setColor(Color.yellow);
             
 FlowLayout bar = new FlowLayout();
    int x = 55;
    int y = 55;
    int width = getSize().width - 100;
    int height = getSize().height - 100;
    int diameter = Math.min(width, height);
     cir.fillOval(x, y, diameter, diameter);
}
}
}
charliebabyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
suprapto45Connect With a Mentor Commented:
0
 
charliebabyAuthor Commented:
Thank you, I will do the best I can, that's a start, Charliebaby.
0
 
charliebabyAuthor Commented:
Thank you, I will do the best I can, that's a start, Charliebaby.
0
 
suprapto45Commented:
:).

Get back to us if you found any problem.

David
0
 
charliebabyAuthor Commented:
Thank you again David,Charlie.
0
All Courses

From novice to tech pro — start learning today.