ソースを参照

Fin de l'interface

Nathan Spaeter 5 年 前
コミット
410c251147
1 ファイル変更22 行追加2 行削除
  1. 22 2
      src/main/View.java

+ 22 - 2
src/main/View.java

@@ -1,14 +1,16 @@
 package main;
 
+import javax.imageio.ImageIO;
 import javax.swing.*;
 import java.awt.*;
+import java.io.File;
 
 public class View extends JFrame {
 
     private JButton boutonExport= new JButton("Exporter");
     private JButton boutonReset = new JButton("Décocher cases");
     private JPanel pan = new JPanel();
-    private GridLayout grid = new GridLayout();
+    private JPanel panimg = new JPanel();
 
     public static void main(String[] args){
         new View();
@@ -16,13 +18,31 @@ public class View extends JFrame {
 
     public View(){
         this.setTitle("Jul Project");
-        this.setSize(800, 800);
+        this.setSize(800, 1040);
         this.setLocationRelativeTo(null);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setLayout(new BorderLayout());
         this.getContentPane().add((pan), BorderLayout.SOUTH);
+        this.getContentPane().add((panimg), BorderLayout.CENTER);
+
+        panimg.setLayout(new GridLayout(5,4));
+        for (int i=0;i<20;i++){
+            JButton button = new JButton();
+            button.setSize(new Dimension(200,200));
+            try {
+
+                ImageIcon icone = new ImageIcon("./jul_img/jul.png");
+                Image img = icone.getImage().getScaledInstance(button.getWidth(),button.getHeight(), Image.SCALE_DEFAULT);
+                button.setIcon(new ImageIcon(img));
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+            panimg.add(button);
+        }
+
         pan.add(boutonExport);
         pan.add(boutonReset);
+
         this.setVisible(true);
     }
 }