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);
}
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);
}
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;
}
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;
}
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);
}
}
Aggregations