Search in sources :

Example 11 with UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel in project Almura by AlmuraDev.

the class UIMessageBox method construct.

private void construct(MalisisGui gui) {
    setTopPadding(topPadding);
    setBottomPadding(bottomPadding);
    if (!this.message.isEmpty()) {
        final UILabel messageLabel = new UILabel(gui, this.message, true);
        messageLabel.setSize(UIComponent.INHERITED, UIComponent.INHERITED);
        final UISlimScrollbar scrollbar = new UISlimScrollbar(gui, messageLabel, UIScrollBar.Type.VERTICAL);
        scrollbar.setAutoHide(true);
        add(messageLabel.setAnchor(Anchor.CENTER | Anchor.MIDDLE));
    }
    final UIBackgroundContainer buttonContainer = new UIBackgroundContainer(gui);
    final List<UIButton> buttons = new ArrayList<>();
    switch(this.messageBoxButtons) {
        case OK:
            buttons.add(buildButton(gui, "button.ok"));
            break;
        case OK_CANCEL:
            buttons.add(buildButton(gui, "button.ok"));
            buttons.add(buildButton(gui, "button.cancel"));
            break;
        case YES_NO:
            buttons.add(buildButton(gui, "button.yes"));
            buttons.add(buildButton(gui, "button.no"));
            break;
        case YES_NO_CANCEL:
            buttons.add(buildButton(gui, "button.yes"));
            buttons.add(buildButton(gui, "button.no"));
            buttons.add(buildButton(gui, "button.cancel"));
            break;
        case CLOSE:
            buttons.add(buildButton(gui, "button.close"));
    }
    int width = 0;
    int x = 0;
    for (UIButton button : buttons) {
        buttonContainer.add(button.setPosition(x, 0));
        x += button.getWidth() + buttonPadding;
        width += button.getWidth();
    }
    width += buttonPadding * (buttons.size() - 1);
    buttonContainer.setSize(width, GuiConfig.Button.HEIGHT);
    buttonContainer.setPosition(0, 5, Anchor.BOTTOM | Anchor.RIGHT);
    buttonContainer.setBackgroundAlpha(0);
    add(buttonContainer);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) UISlimScrollbar(net.malisis.core.client.gui.component.control.UISlimScrollbar) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) ArrayList(java.util.ArrayList) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 12 with UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel in project Almura by AlmuraDev.

the class SimpleContainerScreen method construct.

@SuppressWarnings("deprecation")
@Override
public void construct() {
    if (this.title != Text.EMPTY) {
        final UILabel titleLabel = new UILabel(this, TextSerializers.LEGACY_FORMATTING_CODE.serialize(this.title));
        titleLabel.setFontOptions(FontColors.WHITE_FO);
        titleLabel.setPosition(0, 20, Anchor.TOP | Anchor.CENTER);
        this.addToScreen(titleLabel);
    }
    this.container = new UIVanillaContainer(this);
    this.container.setBackgroundAlpha(0);
    this.container.setPosition(0, 36);
    this.container.setSize(this.width, this.height - 102);
    this.container.setClipContent(true);
    this.addToScreen(this.container);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel)

Aggregations

UILabel (net.malisis.core.client.gui.component.decoration.UILabel)12 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)10 UIButtonBuilder (com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder)8 UIBackgroundContainer (net.malisis.core.client.gui.component.container.UIBackgroundContainer)5 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)4 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)4 UIForm (com.almuradev.almura.shared.client.ui.component.UIForm)3 GuiTexture (net.malisis.core.client.gui.GuiTexture)3 UIFormContainer (com.almuradev.almura.shared.client.ui.component.UIFormContainer)2 UISlimScrollbar (net.malisis.core.client.gui.component.control.UISlimScrollbar)2 ClientCategory (com.almuradev.almura.core.client.config.ClientCategory)1 GuiRemoteTexture (com.almuradev.almura.shared.client.texture.GuiRemoteTexture)1 UISimpleList (com.almuradev.almura.shared.client.ui.component.UISimpleList)1 UISliderBuilder (com.almuradev.almura.shared.client.ui.component.slider.UISliderBuilder)1 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1 UISlot (net.malisis.core.client.gui.component.UISlot)1 UISeparator (net.malisis.core.client.gui.component.decoration.UISeparator)1 UICheckBox (net.malisis.core.client.gui.component.interaction.UICheckBox)1 MalisisSlot (net.malisis.core.inventory.MalisisSlot)1