From 2622f68c51c89b8198aecd02f6bc47e0a795f5a8 Mon Sep 17 00:00:00 2001 From: martins Date: Sun, 23 Oct 2022 22:54:27 +0200 Subject: [PATCH] changement simplification --- .../fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java b/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java index 6900d52..a3efa1c 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java @@ -70,15 +70,14 @@ public class BoutonsMenu extends JComponent{ secondPinceau.setColor(new Color(255, 255, 255)); secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (this.getWidth()/10))); FontMetrics metrics = secondPinceau.getFontMetrics(new Font(Font.SANS_SERIF, Font.BOLD, this.getWidth()/10)); - Rectangle rect= new Rectangle(0, 0, this.getWidth(), this.getHeight()); - int x = rect.x + (rect.width - metrics.stringWidth(this.path)) / 2; - int y = rect.y + ((rect.height - metrics.getHeight()) / 3) + metrics.getAscent(); + int x =(this.getWidth() - metrics.stringWidth(this.path)) / 2; + int y = ((this.getHeight() - metrics.getHeight()) / 3) + metrics.getAscent(); secondPinceau.drawString((this.path.toUpperCase()), x, y); //DISPO OU PAS secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (this.getWidth()/20))); metrics = secondPinceau.getFontMetrics(new Font(Font.SANS_SERIF, Font.BOLD, this.getWidth()/20)); - x = rect.x + (rect.width - metrics.stringWidth(dispo)) / 2; - y = rect.y + ((rect.height - metrics.getHeight()) / 3*2) + metrics.getAscent(); + x = (this.getWidth() - metrics.stringWidth(dispo)) / 2; + y = ((this.getHeight() - metrics.getHeight()) / 3*2) + metrics.getAscent(); secondPinceau.drawString(dispo, x, y); } }