aboutsummaryrefslogtreecommitdiff
path: root/GuiTest/src
diff options
context:
space:
mode:
authorAlexander Haas <alexanderhaas@live.de>2022-10-13 08:08:50 +0200
committerGitHub <noreply@github.com>2022-10-13 09:08:50 +0300
commit9ddc57b0db03fa7afabf23bb7ee490a5c84af393 (patch)
treea1d6de5fb502b92aecacee0150b78d3272f040e1 /GuiTest/src
parentf8c0715d2572fb4a74d308b5ad21d0868180fecb (diff)
downloadLibGui-9ddc57b0db03fa7afabf23bb7ee490a5c84af393.tar.gz
LibGui-9ddc57b0db03fa7afabf23bb7ee490a5c84af393.tar.bz2
LibGui-9ddc57b0db03fa7afabf23bb7ee490a5c84af393.zip
IconInsets for WButton Icon (#175)
* added iconInsets for WButton * fixed some pull request comments * minor code cleanup * more code cleanup * changed intelliJ config to be able to save lines with whitespace * Update src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
Diffstat (limited to 'GuiTest/src')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
index 6c74e28..39b09d6 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
@@ -15,6 +15,7 @@ import io.github.cottonmc.cotton.gui.widget.WGridPanel;
import io.github.cottonmc.cotton.gui.widget.WItemSlot;
import io.github.cottonmc.cotton.gui.widget.WLabel;
import io.github.cottonmc.cotton.gui.widget.WTextField;
+import io.github.cottonmc.cotton.gui.widget.data.Texture;
import io.github.cottonmc.cotton.gui.widget.icon.TextureIcon;
public class TestDescription extends SyncedGuiDescription {
@@ -42,7 +43,8 @@ public class TestDescription extends SyncedGuiDescription {
buttonB.setOnClick(() -> slot.setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))));
root.add(buttonB, 5, 3, 4, 1);
- root.add(new WButton(Text.literal("Button C")), 0, 5, 4, 1);
+ TextureIcon testIcon = new TextureIcon(new Texture(new Identifier("libgui-test", "icon.png")));
+ root.add(new WButton(testIcon, Text.literal("Button C")), 0, 5, 4, 1);
root.add(new WButton(Text.literal("Button D")), 5, 5, 4, 1);
root.add(new WTextField(Text.literal("Type something...")).setMaxLength(64), 0, 7, 5, 1);