diff --git a/.vscode/launch.json b/.vscode/launch.json index 04c4a81..56147c4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,12 @@ { "configurations": [ + { + "type": "java", + "name": "Launch HesSoGarage", + "request": "launch", + "mainClass": "BillGUI.HesSoGarage", + "projectName": "Lab15_OOP_79fdc875" + }, { "type": "java", "name": "Launch GUI2", diff --git a/bin/BillGUI/App.class b/bin/BillGUI/App.class deleted file mode 100644 index 5ed50fb..0000000 Binary files a/bin/BillGUI/App.class and /dev/null differ diff --git a/bin/BillGUI/HesSoGarage.class b/bin/BillGUI/HesSoGarage.class new file mode 100644 index 0000000..2402ace Binary files /dev/null and b/bin/BillGUI/HesSoGarage.class differ diff --git a/bin/BillGUI/ManagerGui.class b/bin/BillGUI/ManagerGui.class index 6c88046..723861d 100644 Binary files a/bin/BillGUI/ManagerGui.class and b/bin/BillGUI/ManagerGui.class differ diff --git a/bin/BillGUI/Row.class b/bin/BillGUI/Row.class new file mode 100644 index 0000000..55b9887 Binary files /dev/null and b/bin/BillGUI/Row.class differ diff --git a/src/BillGUI/App.java b/src/BillGUI/App.java deleted file mode 100644 index 0812c0a..0000000 --- a/src/BillGUI/App.java +++ /dev/null @@ -1,11 +0,0 @@ -package BillGUI; - -public class App { - public static void main(String[] args) { - int rows = 9; - int cols = 2; - String name = "Garage manager \n Prestations"; - String logoFilePath = "src/logo_garage.png"; - new ManagerGui(rows, cols, name, logoFilePath); - } -} diff --git a/src/BillGUI/HesSoGarage.java b/src/BillGUI/HesSoGarage.java new file mode 100644 index 0000000..90e3c50 --- /dev/null +++ b/src/BillGUI/HesSoGarage.java @@ -0,0 +1,12 @@ +package BillGUI; + +public class HesSoGarage { + public static void main(String[] args) { + GarageManager garageManager = new GarageManager(); + ManagerGui managerGui; + String name = "Garage manager
Prestations"; + String logoFilePath = "src/logo_garage.png"; + managerGui = new ManagerGui(name, logoFilePath, garageManager.getServices()); + } +} + diff --git a/src/BillGUI/ManagerGui.java b/src/BillGUI/ManagerGui.java index 10d0432..0d38a1b 100644 --- a/src/BillGUI/ManagerGui.java +++ b/src/BillGUI/ManagerGui.java @@ -2,6 +2,7 @@ package BillGUI; import java.awt.*; import java.awt.event.*; +import java.util.Vector; import javax.swing.*; /** @@ -11,13 +12,62 @@ public class ManagerGui extends JFrame{ GridLayout grid; JLabel Jname; JLabel Jlogo; + ImageIcon logo; + + Vector prestations = new Vector<>(); - public ManagerGui(int n,int m, String name, String logoFilePath){ - grid = new GridLayout(n,m); + /** + * + */ + public ManagerGui(String name, String logoFilePath, String[] prestationsName){ + this.setSize(400,600); + this.setLocation(600,200); + this.setVisible(true); + + grid = new GridLayout(prestationsName.length + 2,2); + this.setLayout(grid); + + //Create and add header + logo = new ImageIcon(logoFilePath); + Jlogo = new JLabel(name); Jname = new JLabel(name); + this.add(Jname); + this.add(Jlogo); + + + //Create rows for prestations + for(String s : prestationsName){ + prestations.add(new Row(s)); + + } + //add rows on the Jframe + for(Row r : prestations){ + this.add(r.label); + this.add(r.spinner); + } + + //Create and add button + JButton ButtonBill = new JButton(); + JButton ButtonQuit = new JButton(); + this.add(ButtonBill); + this.add(ButtonQuit); + + + } - +} + +class Row { + JLabel label; + JSpinner spinner; + + Row(String title){ + label = new JLabel(title); + spinner = new JSpinner(); + } } + +