|
@@ -3,7 +3,10 @@ package main;
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
|
import javax.swing.*;
|
|
import javax.swing.*;
|
|
|
import java.awt.*;
|
|
import java.awt.*;
|
|
|
|
|
+import java.awt.event.ActionEvent;
|
|
|
|
|
+import java.awt.event.ActionListener;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.util.Collection;
|
|
|
|
|
|
|
|
public class View extends JFrame {
|
|
public class View extends JFrame {
|
|
|
|
|
|
|
@@ -28,6 +31,7 @@ public class View extends JFrame {
|
|
|
panimg.setLayout(new GridLayout(5,4));
|
|
panimg.setLayout(new GridLayout(5,4));
|
|
|
for (int i=0;i<20;i++){
|
|
for (int i=0;i<20;i++){
|
|
|
JButton button = new JButton();
|
|
JButton button = new JButton();
|
|
|
|
|
+ button.setBackground(Color.RED);
|
|
|
button.setSize(new Dimension(200,200));
|
|
button.setSize(new Dimension(200,200));
|
|
|
try {
|
|
try {
|
|
|
ImageJul julImg = new ImageJul(new Jul());
|
|
ImageJul julImg = new ImageJul(new Jul());
|
|
@@ -37,6 +41,11 @@ public class View extends JFrame {
|
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
|
}
|
|
}
|
|
|
|
|
+ button.addActionListener(e -> {
|
|
|
|
|
+ Color bg = button.getBackground().equals(Color.GREEN) ? Color.RED: Color.GREEN;
|
|
|
|
|
+ button.setBackground(bg);
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
panimg.add(button);
|
|
panimg.add(button);
|
|
|
}
|
|
}
|
|
|
|
|
|