The Artima Developer Community
Sponsored Link

Java Answers Forum
problem when draw pie chart with g.fillArc .. Help please

1 reply on 1 page. Most recent reply: Nov 30, 2003 6:51 AM by David

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
thanawat

Posts: 5
Nickname: follownet
Registered: Nov, 2003

problem when draw pie chart with g.fillArc .. Help please Posted: Nov 28, 2003 2:23 PM
Reply to this message Reply
Advertisement
Hi, i try to draw piechart with multicolor.

I try some thing like code below to draw 3 piece of circle. First 2 piece is working, but the last one show something wron. For each piece of circle should be 50 degree, but only last one show something like 150 degree. What happen?? How can i fix this??

import java.awt.*;

class post extends Frame
{
static int a,b;
public post()
{
setSize(300,300);
setBackground(Color.blue);
setTitle("title");
}

pub lic void paint(Graphics g)
{
super.paint(g);
g.setColor(Color.white);
g.fillOval(75,75,150,150);

g.set Color(Color.blue);
g.fillArc(75,75,150,150,0,50);

g.setColor(Color.green);
g.fi llArc(75,75,150,150,50,100);

g.setColor(Color.pink);
g.fillArc(75,75,150,150,10 0,150);
}
}

class demo
{
public static void main(String[] args)
{
post MyWindow = new post();
MyWindow.show();
}
}

Best regards
Ned


David

Posts: 150
Nickname: archangel
Registered: Jul, 2003

Re: problem when draw pie chart with g.fillArc .. Help please Posted: Nov 30, 2003 6:51 AM
Reply to this message Reply
g.fillArc(75,75,150,150,10 0,150);

I'm rather surprised that this code even compiled. You shouldn't have a space between in "10 0".

Flat View: This topic has 1 reply on 1 page
Topic: ScrollBar problem.. Previous Topic   Next Topic Topic: dft in java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use