Link to home
Start Free TrialLog in
Avatar of charliebaby
charliebaby

asked on

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);
}
}
}
ASKER CERTIFIED SOLUTION
Avatar of suprapto45
suprapto45
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of charliebaby
charliebaby

ASKER

Thank you, I will do the best I can, that's a start, Charliebaby.
Thank you, I will do the best I can, that's a start, Charliebaby.
:).

Get back to us if you found any problem.

David
Thank you again David,Charlie.