| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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 JPanel panimg = new JPanel();
- public static void main(String[] args){
- new View();
- }
- public View(){
- this.setTitle("Jul Project");
- 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 {
- ImageJul julImg = new ImageJul(new Jul());
- Image iconeJul = julImg.genImage();
- Image img = iconeJul.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);
- }
- }
|