From 19349d89aecbbffb88a19c83fd55011f0e8969b4 Mon Sep 17 00:00:00 2001 From: Lyanis Souidi Date: Fri, 28 Apr 2023 03:16:05 +0200 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20de=20la=20fonctionnalit?= =?UTF-8?q?=C3=A9=20au=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/HomeView.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/HomeView.java b/src/HomeView.java index 59f9fe4..83253e5 100644 --- a/src/HomeView.java +++ b/src/HomeView.java @@ -95,7 +95,7 @@ public class HomeView extends JPanel { return choisirGrille; } - private static JButton importerGrille(JFrame window) { + private static JButton importerGrille(Window window) { JPanel panel = new JPanel(); JButton importerGrille = new JButton("Importer une grille"); importerGrille.setPreferredSize(new Dimension(250, 50)); @@ -108,7 +108,14 @@ public class HomeView extends JPanel { int choix = fileChooser.showOpenDialog(panel); if (choix == JFileChooser.APPROVE_OPTION) { File fichier = fileChooser.getSelectedFile(); - // TODO: charger la grille depuis le fichier + try { + GridView gridView = new GridView(window); + new GridController(FileManager.importGrid(fichier), gridView); + window.setContentPane(gridView); + window.validate(); + } catch (Exception ex) { + JOptionPane.showMessageDialog(panel, ex.getMessage(), "Erreur", JOptionPane.ERROR_MESSAGE); + } } });