From 3fbf9d1a6810485279ec3eed0378614a59a2315c Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 26 Feb 2021 01:26:44 +0900 Subject: ok loc config --- .../dungeonsguide/gui/elements/MNavigatingPane.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java') 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 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)); -- cgit