Here you can find the source of drawPolygons(final Graphics g, final Collection> v)
Parameter | Description |
---|---|
g | the graphics context |
v | a Container of polygons, other classes are ignored |
public static void drawPolygons(final Graphics g, final Collection<?> v)
//package com.java2s; import java.awt.Graphics; import java.awt.Polygon; import java.util.Collection; import java.util.Iterator; public class Main { /**/*from w ww .ja va2 s . c om*/ * draw a bunch of polygons * * @param g the graphics context * @param v a Container of polygons, other classes are ignored **/ public static void drawPolygons(final Graphics g, final Collection<?> v) { drawPolygons(g, v.iterator()); } /** * draw a bunch of polygons * * @param g the graphics context * @param iter an Enumeration of polygons, other classes are ignored **/ public static void drawPolygons(final Graphics g, final Iterator<?> iter) { while (iter.hasNext()) { final Object obj = iter.next(); if (obj instanceof Polygon) { g.drawPolygon((Polygon) obj); } } } }