import java.awt.*;
import javax.swing.*; 

public class DrawPoly {
    public static void main(String[] args) {
	JFrame frame = new JFrame();
	frame.setSize(500,500);
	frame.setTitle("Draw Polygon, Polyline");
	frame.getContentPane().setBackground(Color.BLACK);
	
	frame.getContentPane().add(new JPanel(){
		public void paintComponent(Graphics g) {
		    setOpaque(false);
		    g.setColor(Color.GREEN);
		    int[] xs = new int[]{100, 200, 300, 400, 250};
		    int[] ys = new int[]{100, 90, 60, 125, 200};
		    g.drawPolygon(xs, ys, xs.length);
		    g.setColor(Color.RED);
		    int[] xs2 = new int[]{100, 200, 250, 300, 400, 250};
		    int[] ys2 = new int[]{350, 350, 250, 350, 350, 450};
		    g.fillPolygon(xs2, ys2, xs2.length);
		}
	    });
	
	frame.setVisible(true);
    }
}

