Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

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);
}
}
}
0
charliebaby
Asked:
charliebaby
  • 3
  • 2
1 Solution
 
suprapto45Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now