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(J Frame.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);
}
}
}
class Graph extends JFrame {
public Graph() {
super("PIE CHART");
setSize(500, 500);
setDefaultCloseOperation(J
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, I will do the best I can, that's a start, Charliebaby.
:).
Get back to us if you found any problem.
David
Get back to us if you found any problem.
David
ASKER
Thank you again David,Charlie.
ASKER