use of com.spinyowl.legui.component.Button in project legui by SpinyOwl.
the class SingleClassExample2 method createLeftPanel.
private static Panel createLeftPanel() {
Panel leftPanel = new Panel();
leftPanel.getStyle().setMargin(20F);
leftPanel.getStyle().setMinWidth(200F);
leftPanel.getStyle().setWidth(200F);
leftPanel.getStyle().setMinHeight(HEIGHT - 40F);
leftPanel.getStyle().setPosition(RELATIVE);
leftPanel.getStyle().getFlexStyle().setFlexDirection(COLUMN);
leftPanel.getStyle().getFlexStyle().setJustifyContent(JustifyContent.FLEX_START);
leftPanel.getStyle().getFlexStyle().setAlignContent(AlignContent.STRETCH);
leftPanel.getStyle().getFlexStyle().setAlignItems(AlignItems.STRETCH);
leftPanel.getStyle().setDisplay(FLEX);
Panel personPanel = createPersonPanel();
leftPanel.add(personPanel);
SimpleLineBorder border = new SimpleLineBorder(ColorConstants.lightGray(), 0.8f);
leftPanel.add(createMenuButton("Protect", border));
leftPanel.add(createMenuButton("Some", border));
leftPanel.add(createMenuButton("Cool", border));
leftPanel.add(createMenuButton("Aliens", border));
Button apply = new Button("\uF12C");
setBottomButtonStyles(apply, border);
apply.getStyle().getBackground().setColor(ColorUtil.rgba(0xa5, 0xd6, 0xa7, 1));
apply.getStyle().setLeft(0);
apply.getStyle().setBottom(0);
leftPanel.add(apply);
Button decline = new Button("\uF156");
setBottomButtonStyles(decline, border);
decline.getStyle().getBackground().setColor(ColorUtil.rgba(0xef, 0x9a, 0x9a, 1));
decline.getStyle().setRight(0);
decline.getStyle().setBottom(0);
leftPanel.add(decline);
return leftPanel;
}
use of com.spinyowl.legui.component.Button 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);
}
use of com.spinyowl.legui.component.Button in project legui by SpinyOwl.
the class ShaderProgram method createFrameWithGUI.
private Frame createFrameWithGUI() {
Frame frame = new Frame(WIDTH, HEIGHT);
// Set background color for frame
frame.getContainer().getStyle().getBackground().setColor(ColorConstants.transparent());
frame.getContainer().setFocusable(false);
Button button = new Button("Add components", 20, 20, 160, 30);
SimpleLineBorder border = new SimpleLineBorder(ColorConstants.black(), 1);
button.getStyle().setBorder(border);
boolean[] added = { false };
button.getListenerMap().addListener(MouseClickEvent.class, (MouseClickEventListener) event -> {
if (!added[0]) {
added[0] = true;
for (Component c : generateOnFly()) {
frame.getContainer().add(c);
}
}
});
button.getListenerMap().addListener(CursorEnterEvent.class, (CursorEnterEventListener) System.out::println);
frame.getContainer().add(button);
return frame;
}
use of com.spinyowl.legui.component.Button in project legui by SpinyOwl.
the class WidgetTreeExample method createGuiElements.
@Override
protected void createGuiElements(Frame frame) {
Button button = new Button("Toggle autoclose", 10, 10, WIDTH - 20, 20);
button.getListenerMap().addListener(MouseClickEvent.class, e -> {
if (e.getAction() == MouseClickEvent.MouseClickAction.CLICK) {
autoCloseWidgets = !autoCloseWidgets;
}
});
frame.getContainer().add(button);
Widget root = createFlexWidget("Root");
root.setPosition(10, 40);
root.setSize(WIDTH - 20, HEIGHT - 50);
root.setCloseable(false);
Widget rootChild1 = createFlexChildWidget("C1", root);
Widget c1C1 = createFlexChildWidget("c1 c1", root);
c1C1.getContainer().add(createChildWidget("c1 c1 c1", root));
c1C1.getContainer().add(createChildWidget("c1 c1 c2", root));
c1C1.getContainer().add(createChildWidget("c1 c1 c3", root, true));
rootChild1.getContainer().add(c1C1);
rootChild1.getContainer().add(createChildWidget("c1 c2", root));
rootChild1.getContainer().add(createChildWidget("c1 c3", root, true));
Widget rootChild2 = createFlexChildWidget("C2", root, true);
rootChild2.getContainer().add(createChildWidget("c2 c1", root));
rootChild2.getContainer().add(createChildWidget("c2 c2", root));
rootChild2.getContainer().add(createChildWidget("c2 c3", root, true));
root.getContainer().add(rootChild1);
root.getContainer().add(rootChild2);
frame.getContainer().add(root);
}
use of com.spinyowl.legui.component.Button in project legui by SpinyOwl.
the class MultipleWindowsMultipleThreadsExample method createGuiElements.
private static void createGuiElements(Frame frame) {
// Set background color for frame
frame.getContainer().getStyle().getBackground().setColor(ColorConstants.lightBlue());
Button button = new Button("Add components", 20, 20, 160, 30);
SimpleLineBorder border = new SimpleLineBorder(ColorConstants.black(), 1);
button.getStyle().setBorder(border);
boolean[] added = { false };
button.getListenerMap().addListener(MouseClickEvent.class, (MouseClickEventListener) event -> {
if (!added[0]) {
added[0] = true;
for (Component c : generateOnFly()) {
frame.getContainer().add(c);
}
}
});
button.getListenerMap().addListener(CursorEnterEvent.class, (CursorEnterEventListener) System.out::println);
frame.getContainer().add(button);
}
Aggregations