From 457cd8520d83f6bad2423f57cf6c1ab53f170459 Mon Sep 17 00:00:00 2001 From: Falkreon <falkreon@gmail.com> Date: Wed, 21 Aug 2019 09:12:06 -0500 Subject: Add grid size setting for WGridPanel. Fixes #7 --- .../io/github/cottonmc/cotton/gui/widget/WGridPanel.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WGridPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WGridPanel.java index a3fcf94..61adddf 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WGridPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WGridPanel.java @@ -1,27 +1,30 @@ package io.github.cottonmc.cotton.gui.widget; public class WGridPanel extends WPanel { + protected int grid = 18; + + public WGridPanel() {} + public WGridPanel(int gridSize) { this.grid = gridSize; } + public void add(WWidget w, int x, int y) { children.add(w); w.parent = this; - w.setLocation(x * 18, y * 18); + w.setLocation(x * grid, y * grid); if (w.canResize()) { - w.setSize(18, 18); + w.setSize(grid, grid); } expandToFit(w); - //valid = false; } public void add(WWidget w, int x, int y, int width, int height) { children.add(w); w.parent = this; - w.setLocation(x * 18, y * 18); + w.setLocation(x * grid, y * grid); if (w.canResize()) { - w.setSize(width * 18, height * 18); + w.setSize(width * grid, height * grid); } expandToFit(w); - //valid = false; } } \ No newline at end of file -- cgit