This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Applets and the fly likes drawRect(  ) with non integers arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "drawRect(  ) with non integers arguments" Watch "drawRect(  ) with non integers arguments" New topic

drawRect( ) with non integers arguments

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all
I'm trying to draw rectangles or any objects with passing parameters other than integeres to drawRect() or to object.setBounds() methods.The problem is i can't found a similar methods to accept floats or doubles .
i tried to use parse methods and convert my flots or doubles to integers and round() to round those nubers to the nearst int values,but when look into the graphs i see the same level
for all values that have decimal points between 0.5 to 0.9 and the same as 0.1 to 0.5.
I hope someone will help me with this.
thanks alot.
Pawel Veselov
Ranch Hand

Joined: Jan 14, 1999
Posts: 165
I don't quite get what you mean. The graphical information is represented by pixels. And there is no way pixel wide can be less or greater than 1, so it's impossible to draw line from 0.1 to 0.5.

With best of best regards, Pawel S. Veselov ( aka Black Angel )
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks for your time.
what i'm trying to do is to dev. a applet chart with Panel or canvas objects as bars.
i need to control the height of those objects using setbounds()
that accepts integers only.
i want to use floats or doubles to control the height of them.
for that when i pass the height value ffrom html file as 1.6 ,it will be as the height value 2 on the display screen and that is not right.
Thanks again.
I agree. Here's the link:
subject: drawRect( ) with non integers arguments
It's not a secret anymore!