A declarative GUI library for Java desktop applications that takes strong inspiration from SolidJS.
Module | Description |
---|---|
rx | reactive primitives |
ui | UI system built on JSignal, Skia (Skija), JWM, and Yoga |
std | standard component library |
prop | annotation processor for component properties |
public class Counter extends Component {
public static void main(String[] args) {
UiThread.start(() -> {
var window = UiUtil.createWindow();
window.setTitle("Counter");
window.setContentSize(250, 250);
new UiWindow(window, Counter::new);
});
}
private final Signal<Integer> count = Signal.create(0);
@Override
public Element render() {
return Node.builder()
.layoutBuilder(lb -> lb
.fill()
.center()
.column()
.gap(10f)
)
.children(Nodes.compose(
Para.builder()
.string(() -> "Count: " + count.get())
.styleBuilder(sb -> sb.textStyleBuilder(tsb -> tsb
.fontSize(20f)
.color(EzColors.BLUE_500)
))
.build(),
Button.builder()
.color(EzColors.BLUE_300)
.action(() -> count.accept(c -> c + 1))
.children(() -> Para.fromString("Increment"))
.build()
))
.build();
}
}