update
This commit is contained in:
@@ -6,6 +6,7 @@ public class Fond extends JPanel implements ActionListener {
|
||||
private JButton Cyan, Magenta, Jaune;
|
||||
|
||||
public Fond() {
|
||||
super();
|
||||
this.setLayout(null);
|
||||
|
||||
this.Cyan = new JButton("Cyan");
|
||||
@@ -26,7 +27,7 @@ public class Fond extends JPanel implements ActionListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evenement) {
|
||||
protected void actionPerformed(ActionEvent evenement) {
|
||||
if (evenement.getSource() == this.Cyan) {
|
||||
this.setBackground(Color.CYAN);
|
||||
} else if (evenement.getSource() == this.Magenta) {
|
||||
|
@@ -15,13 +15,14 @@ public class Attente extends JComponent implements WindowListener {
|
||||
secondPinceau.setColor(this.getForeground());
|
||||
|
||||
if (enArrierePlan) {
|
||||
secondPinceau.setColor(Color.BLACK);
|
||||
int[] xHaut = {100, 150, 200};
|
||||
int[] yHaut = {100, 150, 100};
|
||||
int[] xBas = {100, 150, 200};
|
||||
int[] yBas = {250, 200, 250};
|
||||
secondPinceau.fillPolygon(xHaut, yHaut, 3);
|
||||
secondPinceau.fillPolygon(xBas, yBas, 3);
|
||||
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);
|
||||
} else {
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.fillRect(0, 0, getWidth(), getHeight());
|
||||
@@ -32,14 +33,14 @@ public class Attente extends JComponent implements WindowListener {
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent evenement) {
|
||||
System.out.println("Fenêtre mise en arrière-plan !");
|
||||
System.out.println("Fenêtre mise en arrière-plan");
|
||||
enArrierePlan = true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
System.out.println("Fenêtre active !");
|
||||
System.out.println("Fenêtre active");
|
||||
enArrierePlan = false;
|
||||
repaint();
|
||||
}
|
||||
|
Reference in New Issue
Block a user