Hi
Java Folks,
Sorry to bother everyone, however, I am all out of ideas on a particular problem that I am having, and am hoping that someone can offer some advice. In short, my Java problem is as follows:
[1]
over the past year I have *successfully* implemented a "graphical geometry editor" using J2SE SDK 1.4.x. Again, everything worked fine under SDK 1.4.x, and life was good.
[2]
recently, however, I downloaded Sun's new J2SE SDK 1.5.0. I compiled my geometry editor successfully (without errors) against this new SDK 1.5.0, and then began using it. However, the following "fillPolygon" method of class Graphics is no longer working as it did before!
class: java.awt.Graphics
method: public void fillPolygon(Polygon p)
In short, any polygon that I render using this method is erroneously "offset" from where it **should** be rendered on my gui. In fact, here is an example of some code that exhibits this problem:
// I define a polygon using values x1,y1,x2,y2,
// which correctly defines a rectangle polygon
java.awt.Polygon squareMBRPoly = new java.awt.Polygon
(
new int [] {x1,x2,x2,x1},
new int [] {y1,y1,y2,y2},
4
);
// I set the graphics object color to an arbitrary value, in this case "orange"
g.setColor(Color.orange);
// I render the outline of the polygon via the "drawPolygon" method,
// which is **successful**, thus I know that my polygon definition
// is valid
g.drawPolygon(squareMBRPoly);
// next, I render a "filled" version of this **same**
// polygon object, however, it is INCORRECTLY offset
// when drawn to the gui. The polygon's shape is correct,
// it is simply been offset erroneously!!!
g.fillPolygon(squareMBRPoly);
[3]
Again, my same "geometry editor" source code, when compiled under J2SE SDK 1.4.x, runs correctly. I only get this problem when I switch to compiling and running my geometry editor under SDK 1.5.0. Offhand, I would say that there is a bug somewhere in the 1.5.0. SDK. This sounds ridiculous I know, however, I cannot think of any other reason for this runtime rendering behavior. FYI: I am SCJP/SCJD certified and have a BS degree in computer science & mathematics (just so you know that I am not a complete idiot. :-)
Any thoughts?
Best Regads,
John Dove
[email protected] [email protected] http://home.nycap.rr.com/jdove