import java.awt.*; import javax.swing.*; public class Case extends JComponent { @Override public void paintComponent(Graphics pinceau) { Graphics secondPinceau = pinceau.create(); if (this.isOpaque()) { secondPinceau.setColor(this.getBackground()); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); } secondPinceau.setColor(Color.BLACK); secondPinceau.drawRect(0, 0, this.getWidth()-3, this.getHeight()-3); secondPinceau.drawRect(1, 1, this.getWidth()-4, this.getHeight()-4); secondPinceau.drawRect(2, 2, this.getWidth()-5, this.getHeight()-5); for (int i = 0; i != 3; i++) { for (int j = 0; j != 3; j++) { secondPinceau.drawRect(this.getWidth()*i/3, this.getHeight()*j/3, this.getWidth()/3, this.getHeight()/3); } } } }