Search in sources :

Example 1 with SimpleLineBorder

use of com.spinyowl.legui.style.border.SimpleLineBorder in project legui by SpinyOwl.

the class ExampleGui method createSecondScrollBar.

private void createSecondScrollBar() {
    ScrollBar scrollBar11 = new ScrollBar(385, 170, 7, 100, 20);
    scrollBar11.setOrientation(Orientation.VERTICAL);
    scrollBar11.setVisibleAmount(20);
    scrollBar11.setArrowsEnabled(false);
    scrollBar11.getStyle().getBackground().setColor(ColorConstants.white());
    scrollBar11.setScrollColor(ColorConstants.darkGray());
    scrollBar11.getStyle().setBorder(new SimpleLineBorder(ColorConstants.darkGray(), 1));
    scrollBar11.getStyle().setBorderRadius(null);
    this.add(scrollBar11);
}
Also used : SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder) ScrollBar(com.spinyowl.legui.component.ScrollBar)

Example 2 with SimpleLineBorder

use of com.spinyowl.legui.style.border.SimpleLineBorder in project legui by SpinyOwl.

the class ExampleGui method createThirdScrollBar.

private void createThirdScrollBar() {
    ScrollBar scrollBar2 = new ScrollBar(250, 280, 100, 20, 20);
    scrollBar2.setOrientation(Orientation.HORIZONTAL);
    scrollBar2.setVisibleAmount(20);
    scrollBar2.setArrowsEnabled(true);
    scrollBar2.getStyle().setBorder(new SimpleLineBorder(ColorConstants.black(), 1));
    scrollBar2.getStyle().getBackground().setColor(ColorConstants.darkGray());
    scrollBar2.setScrollColor(ColorConstants.white());
    scrollBar2.setArrowColor(ColorConstants.white());
    this.add(scrollBar2);
}
Also used : SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder) ScrollBar(com.spinyowl.legui.component.ScrollBar)

Example 3 with SimpleLineBorder

use of com.spinyowl.legui.style.border.SimpleLineBorder in project legui by SpinyOwl.

the class SingleClassExample2 method createPersonPanel.

private static Panel createPersonPanel() {
    Panel personPanel = new Panel();
    personPanel.getStyle().setPosition(RELATIVE);
    personPanel.getStyle().setMinHeight(80F);
    Label personIcon = new Label("\uF009", 10, 10, 60, 60);
    personIcon.getStyle().setFont(FontRegistry.MATERIAL_DESIGN_ICONS);
    personIcon.getStyle().setFontSize(60F);
    personIcon.getStyle().setBorder(new SimpleLineBorder(ColorConstants.black(), 1));
    personPanel.add(personIcon);
    Label username = new Label("John Doe", 80, 20, 100, 20);
    username.getStyle().setFontSize(20f);
    username.getStyle().setFont(FontRegistry.ROBOTO_BOLD);
    personPanel.add(username);
    Label position = new Label("Alien Protector", 80, 40, 100, 20);
    position.getStyle().setFontSize(14f);
    personPanel.add(position);
    return personPanel;
}
Also used : Panel(com.spinyowl.legui.component.Panel) Label(com.spinyowl.legui.component.Label) SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder)

Example 4 with SimpleLineBorder

use of com.spinyowl.legui.style.border.SimpleLineBorder in project legui by SpinyOwl.

the class SingleClassExample method generateOnFly.

private static List<Component> generateOnFly() {
    List<Component> list = new ArrayList<>();
    Widget widget = new Widget(10, 50, 380, 240);
    widget.getContainer().getStyle().setDisplay(FLEX);
    widget.setDraggable(false);
    TabbedPanel tabbedPanel = new TabbedPanel();
    tabbedPanel.getStyle().setPosition(PositionType.RELATIVE);
    tabbedPanel.getStyle().getFlexStyle().setFlexGrow(1);
    tabbedPanel.getStyle().getFlexStyle().setFlexShrink(1);
    tabbedPanel.getStyle().setMargin(10F);
    tabbedPanel.getStyle().setBorder(new SimpleLineBorder(ColorConstants.black(), 1F));
    widget.getContainer().add(tabbedPanel);
    Tab tab1 = new Tab("Planes", new Label("Show all planes available"));
    Tab tab2 = new Tab("Cars", new Label("Show all cars available"));
    Tab tab3 = new Tab("Boats", new Label("Show all boats available"));
    tabbedPanel.addTab(tab1);
    tabbedPanel.addTab(tab2);
    tabbedPanel.addTab(tab3);
    AtomicInteger tabIdx = new AtomicInteger();
    Button addTabButton = new Button("Add tab", 180, 10, 70, 30);
    addTabButton.getListenerMap().addListener(MouseClickEvent.class, event -> {
        if (MouseClickAction.CLICK.equals(event.getAction())) {
            String tabName = "Tab #" + tabIdx.incrementAndGet();
            Component tabComponent = new Panel();
            tabComponent.getStyle().getBackground().setColor(ColorUtil.randomColor());
            tabComponent.getStyle().setPadding(10F, 20F);
            tabbedPanel.addTab(new Tab(tabName, tabComponent));
        }
    });
    Button removeTabButton = new Button("Remove tab", 260, 10, 70, 30);
    removeTabButton.getListenerMap().addListener(MouseClickEvent.class, event -> {
        if (MouseClickAction.CLICK.equals(event.getAction()) && tabbedPanel.tabCount() > 0) {
            tabbedPanel.removeTab(tabbedPanel.getCurrentTab());
        }
    });
    Button changeStripPosition = new Button("Switch", 340, 10, 50, 30);
    changeStripPosition.getListenerMap().addListener(MouseClickEvent.class, event -> {
        if (MouseClickAction.CLICK.equals(event.getAction())) {
            TabStripPosition current = tabbedPanel.getTabStripPosition();
            if (TOP == current) {
                tabbedPanel.setTabStripPosition(LEFT);
            } else if (LEFT == current) {
                tabbedPanel.setTabStripPosition(BOTTOM);
            } else if (BOTTOM == current) {
                tabbedPanel.setTabStripPosition(RIGHT);
            } else {
                tabbedPanel.setTabStripPosition(TOP);
            }
        }
    });
    widget.getTitle().getListenerMap().addListener(KeyEvent.class, event -> {
        if (event.getAction() == GLFW_RELEASE) {
            if (event.getKey() == GLFW_KEY_1) {
                tabbedPanel.setTabWidth(30);
            } else if (event.getKey() == GLFW_KEY_2) {
                tabbedPanel.setTabHeight(120);
            } else if (event.getKey() == GLFW_KEY_3) {
                tabbedPanel.setTabStripPosition(LEFT);
            } else if (event.getKey() == GLFW_KEY_4) {
                tabbedPanel.setTabWidth(120);
            } else if (event.getKey() == GLFW_KEY_5) {
                tabbedPanel.setTabHeight(30);
            } else if (event.getKey() == GLFW_KEY_6) {
                tabbedPanel.setTabStripPosition(TOP);
            }
        }
    });
    list.add(addTabButton);
    list.add(removeTabButton);
    list.add(changeStripPosition);
    list.add(widget);
    return list;
}
Also used : ArrayList(java.util.ArrayList) Widget(com.spinyowl.legui.component.Widget) Label(com.spinyowl.legui.component.Label) TabbedPanel(com.spinyowl.legui.component.TabbedPanel) SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder) TabbedPanel(com.spinyowl.legui.component.TabbedPanel) Panel(com.spinyowl.legui.component.Panel) Tab(com.spinyowl.legui.component.TabbedPanel.Tab) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Button(com.spinyowl.legui.component.Button) TabStripPosition(com.spinyowl.legui.component.TabbedPanel.TabStripPosition) Component(com.spinyowl.legui.component.Component)

Example 5 with SimpleLineBorder

use of com.spinyowl.legui.style.border.SimpleLineBorder in project legui by SpinyOwl.

the class FlatComponentTheme method apply.

/**
 * Used to apply theme only for component and not apply for child components.
 *
 * @param component component to apply theme.
 */
@Override
public void apply(T component) {
    super.apply(component);
    if (settings.borderColor().z == 0) {
        component.getStyle().setBorder(null);
    } else {
        component.getStyle().setBorder(new SimpleLineBorder(settings.borderColor(), 1));
    }
    component.getStyle().setBorderRadius(1f);
    component.getStyle().getBackground().setColor(settings.backgroundColor());
    component.getStyle().setFocusedStrokeColor(settings.strokeColor());
    component.getStyle().setTextColor(settings.textColor());
    component.getStyle().setFontSize(settings.fontSize());
    component.getStyle().setFont(settings.font());
    component.getStyle().setHorizontalAlign(HorizontalAlign.LEFT);
    component.getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
    if (settings.shadowColor() != null && settings.shadowColor().length() > 0.00001f) {
        component.getStyle().setShadow(new Shadow(2, 2, 20, -8, settings.shadowColor()));
    } else {
        component.getStyle().setShadow(null);
    }
    Tooltip tooltip = component.getTooltip();
    if (tooltip != null) {
        Themes.getDefaultTheme().applyAll(tooltip);
    }
    List<? extends Component> childComponents = component.getChildComponents();
    for (Component child : childComponents) {
        Themes.getDefaultTheme().applyAll(child);
    }
}
Also used : Tooltip(com.spinyowl.legui.component.Tooltip) Shadow(com.spinyowl.legui.style.shadow.Shadow) SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder) Component(com.spinyowl.legui.component.Component)

Aggregations

SimpleLineBorder (com.spinyowl.legui.style.border.SimpleLineBorder)11 Button (com.spinyowl.legui.component.Button)6 Component (com.spinyowl.legui.component.Component)6 Label (com.spinyowl.legui.component.Label)6 ArrayList (java.util.ArrayList)5 Frame (com.spinyowl.legui.component.Frame)4 CursorEnterEvent (com.spinyowl.legui.event.CursorEnterEvent)4 MouseClickEvent (com.spinyowl.legui.event.MouseClickEvent)4 CursorEnterEventListener (com.spinyowl.legui.listener.CursorEnterEventListener)4 MouseClickEventListener (com.spinyowl.legui.listener.MouseClickEventListener)4 EventProcessorProvider (com.spinyowl.legui.listener.processor.EventProcessorProvider)4 ColorConstants (com.spinyowl.legui.style.color.ColorConstants)4 CallbackKeeper (com.spinyowl.legui.system.context.CallbackKeeper)4 Context (com.spinyowl.legui.system.context.Context)4 LayoutManager (com.spinyowl.legui.system.layout.LayoutManager)4 Renderer (com.spinyowl.legui.system.renderer.Renderer)4 List (java.util.List)4 Vector2i (org.joml.Vector2i)4 GLFW (org.lwjgl.glfw.GLFW)4 GLFW_KEY_ESCAPE (org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE)4