Created
March 17, 2015 18:44
-
-
Save Victorious3/f89ceb4c4e5cdff59905 to your computer and use it in GitHub Desktop.
NOVA GUIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gui testGUI = new Gui("testgui").setPreferredSize(300, 200) | |
.add(new Button("testbutton2", "I'm EAST") | |
.setMaximumSize(Integer.MAX_VALUE, 120) | |
.onEvent((event, component) -> { | |
System.out.println("Test button pressed! " + Side.get()); | |
}, ActionEvent.class, Side.BOTH), Anchor.EAST) | |
.add(new Container("centerContainer").setLayout(new FixedLayout()) | |
.add(new Button("notherbutton", "It's all relative..."), "north: 50% west: 20") | |
.add(new Label("notherlabel", "Some random text here").setBackground(new Background(Color.red)), "north: 50% east: 50%") | |
) | |
.add(new Button("testbutton4", "I'm SOUTH"), Anchor.SOUTH) | |
.add(new Container("container") | |
.add(new Container("container").setLayout(new FlowLayout()) | |
.add(new Button("testbutton5", "I'm the FIRST Button and need lots of space")) | |
.add(new Label("testlabel1", "I'm some label hanging around").setBackground(new Background(Color.white))) | |
.add(new Button("testbutton7", "I'm THIRD")) | |
.add(new Button("testbutton8", "I'm FOURTH")) | |
) | |
.add(new Button("close", "X") | |
.onEvent((event, component) -> guiFactory.closeGui(), ActionEvent.class) | |
, Anchor.EAST) | |
, Anchor.NORTH) | |
.onGuiEvent((event) -> { | |
System.out.println("Test GUI initialized! " + event.player.getDisplayName() + " " + event.position); | |
}, BindEvent.class) | |
.onGuiEvent((event) -> { | |
System.out.println("Test GUI closed!"); | |
}, UnBindEvent.class); | |
guiFactory.registerGui(testGUI, id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment