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