diff --git a/.vscode/settings.json b/.vscode/settings.json index 37d5d4a..0b84c17 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,9 @@ "lib/**/*.jar" ], "liveshare.shareExternalFiles": false, - "liveshare.allowGuestDebugControl": true + "liveshare.allowGuestDebugControl": true, + "cSpell.words": [ + "Jlogo", + "Jname" + ] } diff --git a/bin/BillGUI/ButtonListenerManager.class b/bin/BillGUI/ButtonListenerManager.class index a064d34..b0bd01d 100644 Binary files a/bin/BillGUI/ButtonListenerManager.class and b/bin/BillGUI/ButtonListenerManager.class differ diff --git a/bin/BillGUI/ManagerGui$1.class b/bin/BillGUI/ManagerGui$1.class index 4368c43..fe484da 100644 Binary files a/bin/BillGUI/ManagerGui$1.class and b/bin/BillGUI/ManagerGui$1.class differ diff --git a/bin/BillGUI/ManagerGui$2.class b/bin/BillGUI/ManagerGui$2.class index a6f9468..c13c13f 100644 Binary files a/bin/BillGUI/ManagerGui$2.class and b/bin/BillGUI/ManagerGui$2.class differ diff --git a/bin/BillGUI/ManagerGui.class b/bin/BillGUI/ManagerGui.class index bc89d98..8eb96d5 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 index f5075da..2356188 100644 Binary files a/bin/BillGUI/Row.class and b/bin/BillGUI/Row.class differ diff --git a/src/BillGUI/ManagerGui.java b/src/BillGUI/ManagerGui.java index b02f5aa..fd9938a 100644 --- a/src/BillGUI/ManagerGui.java +++ b/src/BillGUI/ManagerGui.java @@ -15,6 +15,7 @@ public class ManagerGui extends JFrame { ImageIcon logo; String buttonNameQuit = "Quit"; String buttonNameBill = "Show bill"; + double ratio = 207.0/163.0; Vector prestations = new Vector<>(); @@ -33,10 +34,13 @@ public class ManagerGui extends JFrame { this.setLayout(grid); //Create and add header - logo = new ImageIcon(logoFilePath); - Jlogo = new JLabel(logo); + //logo = new ImageIcon(logoFilePath); Jname = new JLabel(name); this.add(Jname); + + //logo = new ImageIcon(new ImageIcon(logoFilePath).getImage().getScaledInstance(207, 163, Image.SCALE_DEFAULT)); + //Jlogo = new JLabel(logo); + Jlogo = resize(Jname, logoFilePath); this.add(Jlogo); @@ -86,6 +90,16 @@ public class ManagerGui extends JFrame { this.add(buttonQuit); } + + private JLabel resize(JLabel Jlogo, String logoFilePath){ + //TODO put in listener for resize when frame is resize. + int width = (int)Jlogo.getSize().getWidth(); + int height = (int)Jlogo.getSize().getHeight(); + height = height > 0 ? height:65; + System.out.println(width + "x"+ height); + ImageIcon logo = new ImageIcon(new ImageIcon(logoFilePath).getImage().getScaledInstance((int) (height*ratio), height, Image.SCALE_DEFAULT)); + return new JLabel(logo); + } }