aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes POLYPOLYGON Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "POLYPOLYGON" Watch "POLYPOLYGON" New topic
Author

POLYPOLYGON

Paul Hung
Greenhorn

Joined: Jan 12, 2003
Posts: 1
DEAR ALL:
POLYPOLYGON IS A METHOD TO DRAWING PLOYGON INSIDE ONE POLYGON. How could I do in java?
Steve Lovelace
Ranch Hand

Joined: Sep 03, 2003
Posts: 125
The basic trick is to subclass JPanel (I'm assuming you're using Swing) and override the paintComponent() method. Your method will use java.awt.Graphics2D.draw(Shape) to render your polypolygon. You could put draw() in a loop and iterate over a collection of polygon edges (java.awt.geom.Line2D), or you could build a java.awt.geom.GeneralPath for each polygon, inner and outer, and then invoke draw() on each one.


The Inner that is named is not the true Inner.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: POLYPOLYGON