From e3c2a96428fe01bdeb3307edb2999c44736a400e Mon Sep 17 00:00:00 2001 From: besson Date: Wed, 30 Nov 2022 16:33:16 +0100 Subject: [PATCH] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'src/?= =?UTF-8?q?Test'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Test/Controller.java | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Test/Controller.java b/src/Test/Controller.java index 19ef026..c4fe9d7 100644 --- a/src/Test/Controller.java +++ b/src/Test/Controller.java @@ -55,6 +55,7 @@ public class Controller implements ActionListener, ListSelectionListener { }; } + /** * Pour afficher une JTable sans listener * @@ -286,7 +287,7 @@ public class Controller implements ActionListener, ListSelectionListener { } else if(Objects.equals(command, "av::AddStudGrup")) { - Object[][] data = new Object[this.e.size()][3]; + ArrayList> data = new ArrayList(); String[] titre = { "Nom", @@ -295,27 +296,30 @@ public class Controller implements ActionListener, ListSelectionListener { "Action" }; - for(int i = 0; i <= this.e.size()-1; i++) { - if(this.e.get(i).getGroupe() == -1) { - Object[] info = { - this.e.get(i).getNom(), - this.e.get(i).getPrenom(), - String.valueOf(this.e.get(i).getGroupe()), - "[AJOUTER]" - }; + int i, j; - data[i] = info; + for(i = 0; i <= this.e.size()-1; i++) { + if(this.e.get(i).getGroupe() == -1) { + ArrayList info = new ArrayList<>(); + info.add(this.e.get(i).getNom()); + info.add(this.e.get(i).getNom()); + info.add(String.valueOf(this.e.get(i).getGroupe())); + info.add("[AJOUTER]"); + + data.add(info); } } + String[][] stringArray = data.stream().map(u -> u.toArray(new String[0])).toArray(String[][]::new); + DisplayWithListner( this.av, - "Attriuer un groupe a un etudiant", + "Attribuer un groupe a un etudiant", 350, 400, this.av.getX(), this.av.getY(), - this.createJTable(data, titre) + this.createJTable(stringArray, titre) ); }