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