[4982] in java-interest
Re: bounds() may not return correct values ?
daemon@ATHENA.MIT.EDU (Greg Ewing)
Thu Jan 25 00:32:35 1996
Date: Thu, 25 Jan 1996 11:18:21 +1100
From: grege@optimation.com.au (Greg Ewing)
To: java-interest@java.sun.com
Cc: jmr@nynexst.com
> From NewsGroup_comp-lang-java Thu Jan 25 08:20 EST 1996
> From: NewsGroup_comp-lang-java
> >From: jmr@nynexst.com (Jean-Michel Rosso)
> Subject: bounds() may not return correct values ?
> Date: 23 Jan 1996 17:39:22 GMT
> Nntp-Posting-Host: ibm10.nynexst.com
>
>
> Does any one has noticed the following:
>
> // ...
>
> Rectangle r = bounds();
> g.drawLine (r.x, r.y + (r.height/2), r.x + r.width, r.y + (r.height/2));
>
> // This should draw a line RIGHT in the center of the component
> // on the horizontal axis. Well not quite, it's off by a few pixels.
>
> Is this a bug, or I need a good pair of bi-focals or my math is wrong ?
>
Don't forget that whenever your bounds().height is uneven, the line will be
drawn one pixel off (i.e. r.height/2 returns a float which is cast to integer).
GREG
grege@optimation.com.au
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com