From 8cb848817b3c6602011f5383e75d616a700469a4 Mon Sep 17 00:00:00 2001 From: martins Date: Mon, 24 Oct 2022 13:33:49 +0200 Subject: [PATCH] centrage --- .../fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java b/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java index 0f61249..959c43a 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Menu/View/BoutonsMenu.java @@ -70,14 +70,10 @@ 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(secondPinceau.getFont()); - 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); + secondPinceau.drawString(this.path.toUpperCase(), (this.getWidth()/2-metrics.stringWidth(this.path.toUpperCase())/2), (this.getHeight()-metrics.getHeight())/3+metrics.getAscent()); //DISPO OU PAS secondPinceau.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (this.getWidth()/20))); metrics = secondPinceau.getFontMetrics(secondPinceau.getFont()); - x = (this.getWidth() - metrics.stringWidth(dispo)) / 2; - y = ((this.getHeight() - metrics.getHeight()) / 3*2) + metrics.getAscent(); - secondPinceau.drawString(dispo, x, y); + secondPinceau.drawString(dispo, (this.getWidth()/2-metrics.stringWidth(dispo)/2), (this.getHeight()-metrics.getHeight())/3*2+metrics.getAscent()); } }