public void paint( Graphics g ) { |
Graphics2D g2d = ( Graphics2D ) g; |
g2d.setColor( Color.red ); |
GeneralPath rect = new GeneralPath( GeneralPath.EVEN_ODD ); |
rect.moveTo( 300.0f, 300.0f ); // ul corner |
rect.lineTo( 500.0f, 300.0f ); // ur corner |
rect.lineTo( 500.0f, 400.0f ); // lr corner |
rect.lineTo( 300.0f, 400.0f ); // ll corner |
rect.closePath(); // close the rectangle |
g2d.fill( rect ); |
} |