Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > J2ME's fillTriangle is badly broken

Thread Tools

J2ME's fillTriangle is badly broken

Alex Hunsley
Posts: n/a
J2ME's fillTriangle method is badly broken and doesn't honour the
contract of the method.
For example, to make the following code work as it should:

g.fillTriangle(xx + halfButtonWidth,
yy + buttonWidth,
xx + halfButtonWidth, yy,
xx + buttonWidth + 1, yy + halfButtonWidth);

I have to actually write:

g.fillTriangle(xx + halfButtonWidth,
yy + buttonWidth + 1, // note the +1
xx + halfButtonWidth, yy - 1, // note the -1
xx + buttonWidth + 1, yy + halfButtonWidth);

I can't actually work out what it is doing wrong (haven't checked the
J2ME source code for it yet either). It behaves badly in other ways too:
sometimes it will refuse to draw the rightmost and bottommost lines of
pixels for the triangle that should be drawn.

Just out of curiousity, anyone else been there and worked out in what
way fillTriangle is broken? (And how to predictably fix your calls to
fillTriangle so that they behave as the javadoc promises?)


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are "broken iterators" broken? Steven D'Aprano Python 8 09-28-2008 09:19 PM
Re: Why are "broken iterators" broken? Fredrik Lundh Python 0 09-22-2008 04:32 PM
Re: Why are "broken iterators" broken? Cameron Simpson Python 0 09-22-2008 04:32 AM
advice on basic setup needed badly. Cisco 1 05-09-2005 11:12 AM
Need help w/ Wireless Networking *BADLY* =?Utf-8?B?QmlnVEdhbWVz?= Wireless Networking 7 11-27-2004 03:41 AM