https://github.com/labymod/widgets
Widget model to create custom user interfaces via plugin messages
https://github.com/labymod/widgets
Last synced: 12 months ago
JSON representation
Widget model to create custom user interfaces via plugin messages
- Host: GitHub
- URL: https://github.com/labymod/widgets
- Owner: LabyMod
- Created: 2021-04-25T16:52:34.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T15:30:14.000Z (about 4 years ago)
- Last Synced: 2023-02-28T17:22:16.065Z (about 3 years ago)
- Language: Java
- Homepage:
- Size: 132 KB
- Stars: 8
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Widget model to create custom User Interfaces via plugin messages
Click [here](https://docs.labymod.net/pages/server/minecraft/screen/) for more detailed information.
### Available widgets:
- Button
- Text Field
- Label
- Color Picker
- Image
### Example

### Serialize widgets
```java
// Create new screen
WidgetScreen screen = new WidgetScreen(42); // The client will send this id back on an interaction
// Centered anchor
Anchor anchor = new Anchor(50, 50); // X: 50% Y: 50%
// Add button to widget list
screen.addWidget(new ButtonWidget(0, anchor, -50, 20, "Apply", 100, 20));
// Serialize widgets
JsonObject object = screen.toJsonObject(EnumScreenAction.OPEN); // OPEN = Open the screen
```
### Anchor explanation image
