22 lines
652 B
Java
22 lines
652 B
Java
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class sautoir
|
|
{
|
|
@Override
|
|
protected void paintComponent(Graphics g)
|
|
{
|
|
Graphics pinceau = g.create();
|
|
if(isOpaque())
|
|
{
|
|
pinceau.setColor(getBackground());
|
|
pinceau.fillRect(0, 0, getWidth(), getHeight());
|
|
}
|
|
pinceau.setColor(Color.CYAN);
|
|
int[] triangleXPoints = {0, getWidth()/2, getWidth()};
|
|
int[] topTriangleXPoints = {0, getHeight()/2, 0};
|
|
pinceau.fillPolygon(triangleXPoints, topTriangleXPoints, 3);
|
|
int[] bottomTriangleXPoints = {getHeight(), getHeight()/2, getHeight()};
|
|
pinceau.fillPolygon(triangleXPoints, bottomTriangleXPoints, 3);
|
|
}
|
|
} |