File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Filling polygons. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Filling polygons." Watch "Filling polygons." New topic

Filling polygons.

Michael Boehm
Ranch Hand

Joined: Jun 02, 2010
Posts: 51
Using the Graphics class I am drawing some polygons. Some of these I fill. The polygons are to be drawn with black and I want to fill them with a different color. Problem now is along one boundary line in the polygon, the bounding line will "disappear in steps" after filling with different color. The boundary will now have color alternating between black which the polygon was drawn with and the filling color. This makes it look like a "broken" polygon with incomplete boundary. How can this be fixed ? Here is an attempt to illustrate how it look: ______......_____......_____ where .... is the filling color.
Michael Boehm
Ranch Hand

Joined: Jun 02, 2010
Posts: 51
Ok. I thought I could not fill a polygon untill it was frawn ! Filling the polygon before drawing it with a color different from the fill color solves this.
David Newton

Joined: Sep 29, 2008
Posts: 12617

Glad you figured it out :)
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45415
Moving to our Swing forum.
I agree. Here's the link:
subject: Filling polygons.
jQuery in Action, 3rd edition