diff options
author | Falkreon <falkreon@gmail.com> | 2019-08-21 09:12:06 -0500 |
---|---|---|
committer | Falkreon <falkreon@gmail.com> | 2019-08-21 09:12:06 -0500 |
commit | 457cd8520d83f6bad2423f57cf6c1ab53f170459 (patch) | |
tree | 01ae84509166193fa5b98460470ddfe19c221cd4 /src/main/java | |
parent | f61e0843083b1ca73ad22b5a33e941f3ab21442c (diff) | |
download | LibGui-457cd8520d83f6bad2423f57cf6c1ab53f170459.tar.gz LibGui-457cd8520d83f6bad2423f57cf6c1ab53f170459.tar.bz2 LibGui-457cd8520d83f6bad2423f57cf6c1ab53f170459.zip |
Add grid size setting for WGridPanel. Fixes #7
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WGridPanel.java | 15 |
1 files changed, 9 insertions, 6 deletions
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 |