The Artima Developer Community
Sponsored Link

Java Answers Forum
Help please

1 reply on 1 page. Most recent reply: Nov 28, 2003 10:40 AM by thanawat

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

Help please Posted: Nov 28, 2003 7:09 AM
Reply to this message Reply
Advertisement
Hi! question again.

I wanna know how to convert double to int? From my work i read data from file to double and i wanna use this double to deal with degree in pie chart but i cannot use double in my pie chart. looklike only int can be use overthere.

From program below, degree2[n] is double
but i need to convert degree2[n] to int to use with fillArc.

Any advice please?

public void paint(Graphics g)
{
double degree2[] = new double[datas.size()];

for (int n=0; n<datas.size(); n++ )
{
String string = (String) datas.elementAt(n);
double num = TButils.str2double(string);
degree2[n] = Math.round(num*360/all);
System.out.print(degree2[n]);
}
a=degree2[3]; ** Error here**
super.paint(g);
g.setColor(Color.red);
g.drawOval(75,75,150,150);
g.fill Arc(75,75,150,150,0,a);
}


thanawat

Posts: 5
Nickname: follownet
Registered: Nov, 2003

Re: Help please Posted: Nov 28, 2003 10:40 AM
Reply to this message Reply
Never mind i can do it now


Thank for reading ;)

Flat View: This topic has 1 reply on 1 page
Topic: Course Work Previous Topic   Next Topic Topic: dft

Sponsored Links



Google
  Web Artima.com   

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