Files
DEV/DEV2.1/Sudoku/Case.java
Simoes Lukas fe693705bf TP
2025-03-27 13:35:54 +01:00

26 lines
778 B
Java

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);
}
}
}
}