From 2f45a5a342916a7970f02a05bd696bb13c506a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Thu, 19 May 2022 16:23:25 +0200 Subject: [PATCH] Co-authored-by: Fastium --- .vscode/launch.json | 13 ++++++++--- .vscode/settings.json | 7 +++++- bin/BillGUI/BillGui$1$1.class | Bin 1714 -> 1714 bytes bin/BillGUI/BillGui$1.class | Bin 1891 -> 1792 bytes bin/BillGUI/BillGui.class | Bin 1246 -> 1225 bytes bin/BillGUI/ButtonListenerBill.class | Bin 570 -> 475 bytes bin/BillGUI/ButtonListenerManager.class | Bin 1184 -> 1184 bytes bin/BillGUI/ManagerGui$1.class | Bin 1996 -> 1996 bytes bin/BillGUI/ManagerGui$2.class | Bin 878 -> 878 bytes bin/BillGUI/ManagerGui.class | Bin 2665 -> 3703 bytes bin/BillGUI/Row.class | Bin 522 -> 522 bytes src/BillGUI/BillGui.java | 28 +++++++++++------------- src/BillGUI/HesSoGarage.java | 4 ++-- src/BillGUI/ManagerGui.java | 17 ++++++++++++++ 14 files changed, 48 insertions(+), 21 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index aa60619..8656dcd 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,10 +1,18 @@ { "configurations": [ + { + "type": "java", + "name": "Launch CompleteBankController", + "request": "launch", + "mainClass": "bank.CompleteBankController", + "projectName": "Lab15_OOP_90898795", + "vmArgs": "-enableassertions" + }, { "type": "java", "name": "Launch BankController", "request": "launch", - "mainClass": "bank.BankController", + "mainClass": "bank.CompleteBankController", "projectName": "Lab15_OOP_fc166bd2", "vmArgs": "-enableassertions" }, @@ -57,8 +65,7 @@ "mainClass": "GUI.GUI1", "projectName": "Lab15_OOP_90898795", "liveshare.allowGuestDebugControl": true - }, - + } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 37d5d4a..39a1b51 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,10 @@ "lib/**/*.jar" ], "liveshare.shareExternalFiles": false, - "liveshare.allowGuestDebugControl": true + "liveshare.allowGuestDebugControl": true, + "cSpell.words": [ + "Jframe", + "Jlogo", + "Jname" + ] } diff --git a/bin/BillGUI/BillGui$1$1.class b/bin/BillGUI/BillGui$1$1.class index 3897c8519dcfd076206636ea547f693ed9c9622a..b912c8762c472637ea8cf5d160ada65e7bf6dbe2 100644 GIT binary patch delta 47 zcmdnQyNP#0E-RzaFO53|0(|K+=!Fh9Q~3Zn8RCHvsho B2@?PS diff --git a/bin/BillGUI/BillGui$1.class b/bin/BillGUI/BillGui$1.class index af6dc6443b9bf315c7411ad9616fb4f14fcd31c0..21fed4147613078c5e1b9c1cccc0da94ac3a3dae 100644 GIT binary patch delta 769 zcmZ8eO;b`)7=F(EI(EBW2#LIE3S|h2Aq1J29~lZHnrK>BCfA~(VahT4m^StYnua;M znpQ1Zv}jy}P0X}w)2?68qGkV~dN0++b7r3Bo%g)Y`*nVp&rJR6uTP%=4C7W!U-x)J z`Kd~^npw_8oBXg+d*PSlQ0+@r#92b~p`GK1sIqR^LWg+H;+`%B#fjD7L$`q*_{BHY z7dXbywl7t0tT(13fL;R}Cxj(+j`T5j@7j;-sQq|5y17-kw;f%uH_KZ(f@swy-;}5| zK%0Dbr)fCulLn#~5>KQae-Lp4r;uRa56at1m8WF}HIz<=S2#{HSfV6bE*(j!Yy~S_;Aj^6wZsdoR9f1ZD0l&hJ(#^(iOXU|2Bgh3a>g7<_uhb zNoAU^9C`6x{>h5smD0nmiiWb&zQN$yH@GveUo5Jlt^_2yfZjjwfk3=gtsMi*@!$|V z#I!be2@jANAmrq`@ezmTBA(7Vjy4b|_V3~Nd;`Ja9zrR_QcTl}uonY$3|h*6GuA+o z0)|tnrCLfIXDpTQY-G?<>zItxk$wqfmv|@p7HUe{rJ6;op@dn;a8cD1Ou`5h3{rP- z>MM;dOe0MDNg#tUWXY4GedJNVMN$_?zlaSi!A;6>Xio3{=5nk#%u^Kw>lD2}duSsp zq)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tonListenerBill.class index 5bf7ed9b65f5227c7105f79a3e4ea0eda65020d5..18b5d582fe2cbc099a4e8120b418db1ac802161a 100644 GIT binary patch delta 190 zcmdnRa+{g!)W2Q(7#JAL8N?=XMN6{TWaed-*fBCNYiNcsGO#%3r=)T*Ff(vZ+;^d# zfq@CAlAVErfsug|$kGSWj6j-IYdZtiMj(TUfd@#kfdvy8c!6vlhyn&a27VxqkwJh# m5J-YFn*uS&I7W1h$zY9Q5J{*;kX9i+24Nt@$RGmNDGC5cf)XeI delta 285 zcmcc3yo-hF)W2Q(7#JAL8Kft2MMpAur7<#y_+%xPC06JcmuKds>wCEsCFZ7DGcvH* zWaed-*fBDQYhY8L8OF%K;+&t7%EiFUz{|tH$-u|Rz^tJe#>v3QATY7+LOmnU9(D!} zAjt&8oD5t*32q?E4af(HaA|F4;L+0F%D}%7tVR$>@&OHFU`S+OVMqe%NM;ZM^28vj z8H5=`fIOf+u&Ind(?o%C5Hn4I;vh2_5k~2<0p%DNQjyGHgqs2M6@vs&o{>QktWydA Db?GH( diff --git a/bin/BillGUI/ButtonListenerManager.class b/bin/BillGUI/ButtonListenerManager.class index bbff05fa0048a979dc86111df302c25ae4d45727..09bbe4388c7f41bd0935546c6d7b76a9d34ec564 100644 GIT binary patch delta 49 zcmZ3$xqx%SB4)uB1{Q`^22O@H20n&%24RMd$(xz0IlF+O-9XWv$>uChjQx|VSkwS3 CzYEs@ delta 49 zcmZ3$xqx%SB4)v21{Q`A22O@j20n%|24RNs$(xz0IV*vpRY1||$>uChjCGT%SkwR= CcndxN diff --git a/bin/BillGUI/ManagerGui$1.class b/bin/BillGUI/ManagerGui$1.class index 9db698e233eb9aec7f279926581a93609398c882..c4e80524c721b29aa7a61cb31baa748bd279c747 100644 GIT binary patch delta 51 zcmX@Ze};cUJR76^k&eFC8xmTKr}445{Q8ttW>v zE(LEI%zIwO?W3}TdB>wOzQMFbU;4c)U79H+ccA&Kj-y*h=3(mB6;%a$pW+CK8>LUvSn+=j{X4de_cz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|^rXdu5l6;=a?0tr(^R2Q_HEs^^Tc5 zqu6}+iTc6|sg%|_iL^U!Z!)$N?e#Iof>vPBPPs=sNtP|1O3jIwCRa?}w=bEMc8Tw>^4JkyXIfDzqvxPZzA_P_)`nj$NW@@^ ze76eWoQUZKbuf^lGElZH!}dVg&J4AIJay3=^%)xegN=bwb+yznnk5hrQ_8nl?hClG z>=jOXv~|sW#+{=xL%J&vxJg%*ZVB{6TXG!8a7gfxsH`8#@koYa1-CiJ@eBi+K9J?n z5e<%M&>9VS);dgQhw&*p{GJM9U&t-7hCIVjzf_5285y~3s0yRPyuN;0hq8=?gk9%1 z(zkd*@eRYW$M3$$lZDh8oz=*1+~R4)we_F!By~r%Ii3x<{q8(-QQbkKPUm;!NM%|2 zo3mYW48M_QML0QLkdP$b$ZTlyg^2CsqI}bfY!|Z=muT-3?Mo#@6e?jgp{A-s(}I3#;EF+ z84okYC8>HEZ(3g|FY=PO8eOJXE?lFR1vv`n6)EH_pjUZK8oeQHzAjO>6f5Tq-o!0s z4)7Ll3u=%9y(7qw){ypH>wJROM47A>{Rp$~Gyfko8P}RP`9M-Q_>hmp UmI;~@tA8sShL6P>h4q!c05{nVcK`qY diff --git a/bin/BillGUI/Row.class b/bin/BillGUI/Row.class index 58322f72b990dbda07bd7fe936a8d0a5c02e1283..b409d337a49f80ac6101aeb722670420bbd18f1b 100644 GIT binary patch delta 25 gcmeBT>0;S%osqYcfrX)rL4cv0L7Jgr@)Jfi09E}4SpWb4 delta 25 gcmeBT>0;S%osl<%frTNJL4YBRL7E|b@)Jfi08 0) return Printable.NO_SUCH_PAGE; @@ -63,24 +64,29 @@ public class BillGui extends JFrame{ } }; + // Create and set a A4 paper Paper paper = new Paper(); paper.setImageableArea(0, 0,2480,3508); paper.setSize(2480,3508); - PageFormat format = new PageFormat(); format.setPaper(paper); format.setOrientation(PageFormat.PORTRAIT); + // Set all settings about the printing function pj.setPrintable (printable, format); + // Launch the printer dialog for printing. if (pj.printDialog() == false) return; - try { pj.print(); } catch (PrinterException ex) {} } }); + + this.add(buttonPrint); + + } } @@ -89,14 +95,6 @@ public class BillGui extends JFrame{ * listener to detect the button to print the bill */ class ButtonListenerBill implements ActionListener { - JFrame Jf; - /** - * initialize the listener - * @param Jf //TODO : do we always use the JFrame ? - */ - ButtonListenerBill(JFrame Jf){ - this.Jf = Jf; - } @Override public void actionPerformed(ActionEvent e){}; } diff --git a/src/BillGUI/HesSoGarage.java b/src/BillGUI/HesSoGarage.java index 32e6e9a..0763c33 100644 --- a/src/BillGUI/HesSoGarage.java +++ b/src/BillGUI/HesSoGarage.java @@ -5,9 +5,9 @@ public class HesSoGarage { //Create a new garage GarageManager garageManager = new GarageManager(); String name = "Garage manager
Prestations"; - String logoFilePath = "src/logo_garage.png"; //TODO redimensionnement automatique + String logoFilePath = "src/logo_garage.png"; //Create a new HMI for calculate and print the bill - new ManagerGui(name, logoFilePath, garageManager.getServices(), garageManager); //TODO affichage sans redimensionnement + new ManagerGui(name, logoFilePath, garageManager.getServices(), garageManager); } } diff --git a/src/BillGUI/ManagerGui.java b/src/BillGUI/ManagerGui.java index 60520d9..646e795 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<>(); @@ -41,6 +42,10 @@ public class ManagerGui extends JFrame { Jlogo = new JLabel(logo); 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); //Create rows for prestations @@ -87,6 +92,18 @@ public class ManagerGui extends JFrame { this.add(buttonBill); this.add(buttonQuit); + + this.setVisible(true); + } + + private JLabel resize(JLabel Jlogo, String logoFilePath){ + //TODO put in listener for resize when frame is resized. + 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); } }