List of usage examples for java.awt Polygon reset
public void reset()
From source file:RedBlueBox.java
public void paintComponent(Graphics g) { Insets insets = getInsets();//from w w w . j a va 2 s .c o m int endX = getWidth() - insets.right; int endY = getHeight() - insets.bottom; // get the top-left corner int x = insets.left; int y = insets.top; g.setColor(Color.RED); Polygon p = new Polygon(); p.addPoint(x, y); p.addPoint(endX, y); p.addPoint(x, endY); g.fillPolygon(p); g.setColor(Color.BLUE); p.reset(); p.addPoint(endX, y); p.addPoint(x, endY); p.addPoint(endX, endY); g.fillPolygon(p); }