use of com.spinyowl.legui.style.Style.DisplayType.FLEX in project legui by SpinyOwl.
the class SingleClassExample method createGuiElements.
private static void createGuiElements(Frame frame) {
// Set background color for frame
frame.getContainer().getStyle().getBackground().setColor(ColorConstants.lightBlue());
frame.getContainer().setFocusable(false);
// frame.getContainer().getStyle().setDisplay(FLEX);
// frame.getContainer().getStyle().setPosition(PositionType.ABSOLUTE);
// frame.getContainer().getStyle().getFlexStyle().setFlexDirection(FlexDirection.COLUMN);
//
// Panel menuBar = createPanel(ColorConstants.blue());
// Panel mainPanel = createPanel(ColorConstants.red());
// Panel animationPanel = createPanel(ColorConstants.green());
//
// frame.getContainer().addAll(List.of(menuBar, mainPanel, animationPanel));
Button button = new Button("Add components", 10, 10, 160, 30);
SimpleLineBorder border = new SimpleLineBorder(ColorConstants.black(), 1);
button.getStyle().setBorder(border);
AtomicBoolean added = new AtomicBoolean(false);
button.getListenerMap().addListener(MouseClickEvent.class, (MouseClickEventListener) event -> {
if (!added.getAndSet(true)) {
for (Component c : generateOnFly()) {
frame.getContainer().add(c);
}
}
});
button.getListenerMap().addListener(CursorEnterEvent.class, (CursorEnterEventListener) System.out::println);
mouseTargetLabel = new Label("Hello Label 1", 10, HEIGHT - 30, WIDTH - 20, 20);
frame.getContainer().add(mouseTargetLabel);
frame.getContainer().add(button);
}
Aggregations