From 1ddc923b73cecbe208a42aeee393d8c9c8805a87 Mon Sep 17 00:00:00 2001 From: Amaury Carrade Date: Thu, 10 Sep 2015 15:26:27 +0200 Subject: [PATCH] Fixed explorer GUI to be able to use getSize() in onUpdate(). * BUG: getSize() always returns 0 in the onUpdate method of explorer GUIs. --- .../fr/moribus/imageonmap/guiproko/core/ExplorerGui.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/moribus/imageonmap/guiproko/core/ExplorerGui.java b/src/main/java/fr/moribus/imageonmap/guiproko/core/ExplorerGui.java index a98344f..a4ea4c8 100644 --- a/src/main/java/fr/moribus/imageonmap/guiproko/core/ExplorerGui.java +++ b/src/main/java/fr/moribus/imageonmap/guiproko/core/ExplorerGui.java @@ -79,6 +79,13 @@ abstract public class ExplorerGui extends ActionGui private Mode mode = Mode.CREATIVE; + + public ExplorerGui() + { + // Defined early to be able to use getSize() in the onUpdate method. + setSize(MAX_INVENTORY_SIZE); + } + /** * Sets the displayed data. * @@ -343,8 +350,6 @@ abstract public class ExplorerGui extends ActionGui pageCountY = (int)Math.ceil((double)dataHeight / (double)viewHeight); } - setSize(MAX_INVENTORY_SIZE); - if(pageCountX > 1) { action("previous", MAX_INVENTORY_SIZE - INVENTORY_ROW_SIZE);