浏览代码

Merge branch 'master' into 'master'

# Conflicts:
#   src/main/View.java
KREBS-CHEVRESSON CLEMENT 5 年之前
父节点
当前提交
d92ae5e143
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/main/View.java

+ 10 - 0
src/main/View.java

@@ -6,8 +6,12 @@ import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.File;
+
 import java.util.ArrayList;
 
+import java.util.Collection;
+
+
 public class View extends JFrame {
 
     private JButton boutonExport= new JButton("Exporter");
@@ -39,6 +43,7 @@ public class View extends JFrame {
         panimg.setLayout(new GridLayout(5,4));
         for (int i=0;i<20;i++){
             JButton button = new JButton();
+            button.setBackground(Color.RED);
             button.setSize(new Dimension(200,200));
             try {
                 Jul j = new Jul();
@@ -50,6 +55,11 @@ public class View extends JFrame {
             } catch (Exception ex) {
                 ex.printStackTrace();
             }
+            button.addActionListener(e -> {
+                Color bg = button.getBackground().equals(Color.GREEN) ? Color.RED: Color.GREEN;
+                button.setBackground(bg);
+
+            });
             panimg.add(button);
         }