From 28eb14969329b0cbf6e97c9d62917b17078bba0b Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 7 May 2022 12:06:43 +0200 Subject: change a font size of button --- src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java | 5 ++++- src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java index c76e029..0db6eac 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java @@ -10,6 +10,8 @@ import cc.polyfrost.oneconfig.utils.ColorUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.awt.*; + public class BasicButton extends BasicElement { protected String text; @@ -44,7 +46,8 @@ public class BasicButton extends BasicElement { fontSize = 24f; this.colorPalette = -1; } else { - fontSize = 14f; + if (colorPalette == 0) fontSize = 12; + else fontSize = 14f; this.colorPalette = colorPalette; } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java index b529778..fa40b12 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java @@ -125,8 +125,7 @@ public class ModConfigPage extends Page { if(categories.size() <= 1) return 0; int buttonX = x + 16; for (BasicButton button : categories) { - if (button.getWidth() == 0) - button.setWidth((int) (Math.ceil(RenderManager.getTextWidth(vg, button.getText(), 14f, Fonts.MEDIUM) / 8f) * 8 + 16)); + if (button.getWidth() == 0) button.setWidth((int) (Math.ceil(RenderManager.getTextWidth(vg, button.getText(), 12f, Fonts.MEDIUM) / 8f) * 8 + 16)); button.draw(vg, buttonX, y + 16); buttonX += button.getWidth() + 16; } -- cgit