diff options
author | syeyoung <cyong06@naver.com> | 2021-02-26 01:26:44 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-26 01:26:44 +0900 |
commit | 3fbf9d1a6810485279ec3eed0378614a59a2315c (patch) | |
tree | 1f123b070982a4df4d2f0ec90cbde3ac7b741de1 /src/main/java/kr/syeyoung/dungeonsguide/gui | |
parent | 1a1e216a3e58f13a6ecec14c726283943497d119 (diff) | |
download | Skyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.tar.gz Skyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.tar.bz2 Skyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.zip |
ok loc config
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java index 9621c3af..87160cb6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java @@ -76,9 +76,25 @@ public class MNavigatingPane extends MPanel { totalX += button1.getBounds().width; button.setBounds(new Rectangle(totalX, 0, Math.max(25, fr.getStringWidth(name) + 6), 15)); bookMarks.add(button); - if (bookMarks.size() == 1) + if (currentPage.isEmpty()) currentPage = addr; } + public void addBookmarkRunnable(String name, final Runnable toRun) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + MTabButton button = new MTabButton(this, name, null) { + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + if (lastAbsClip.contains(absMouseX, absMouseY)) { + toRun.run(); + } + } + }; + int totalX = 0; + for (MTabButton button1:bookMarks) + totalX += button1.getBounds().width; + button.setBounds(new Rectangle(totalX, 0, Math.max(25, fr.getStringWidth(name) + 6), 15)); + bookMarks.add(button); + } @Override public List<MPanel> getChildComponents() { @@ -86,7 +102,8 @@ public class MNavigatingPane extends MPanel { if (!pages.containsKey(currentPage)) { MPanel panel = pageGenerator.apply(currentPage); MPanel panel2 = new MPanel() ; - panel2.add(panel); + if (panel != null) + panel2.add(panel); panel2.setBackgroundColor(background2); pages.put(currentPage, panel2); panel2.setBounds(new Rectangle(1,30,getBounds().width-2, getBounds().height-31)); |