import javax.swing.*; import java.awt.*; public class Sautoir extends JComponent { public Sautoir() { super(); } @Override protected void paintComponent(Graphics pinceau) { Graphics secondPinceau = pinceau.create(); secondPinceau.setColor(this.getForeground()); int col = 5; int ligne = 5; int caseWidth = getWidth() / col; int caseHeight = getHeight() / ligne; secondPinceau.setColor(Color.CYAN); int[] xPoints = {0,caseWidth * col, 0, caseWidth * col}; int[] yPoints = {0,0,caseHeight * ligne, caseHeight * ligne}; secondPinceau.fillPolygon(xPoints, yPoints, 4); } }