Search in sources :

Example 1 with ButtonEvent

use of mcjty.lib.gui.events.ButtonEvent in project RFToolsDimensions by McJty.

the class GuiRFToolsManual method initGui.

@Override
public void initGui() {
    super.initGui();
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    textPage = new TextPage(RFToolsDim.instance, mc, this).setText(manualText).setArrowImage(iconGuiElements, 144, 0).setCraftingGridImage(iconGuiElements, 0, 192);
    prevButton = new Button(mc, this).setText("<").addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            textPage.prevPage();
            window.setTextFocus(textPage);
        }
    });
    pageLabel = new Label(mc, this).setText("0 / 0");
    nextButton = new Button(mc, this).setText(">").addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            textPage.nextPage();
            window.setTextFocus(textPage);
        }
    });
    Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16).addChild(prevButton).addChild(pageLabel).addChild(nextButton);
    Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(textPage).addChild(buttonPanel);
    toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
    window = new Window(this, toplevel);
    window.setTextFocus(textPage);
    if (locatePage != null) {
        textPage.gotoNode(locatePage);
        locatePage = null;
    }
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 2 with ButtonEvent

use of mcjty.lib.gui.events.ButtonEvent in project RFToolsDimensions by McJty.

the class GuiDimensionEnscriber method initGui.

@Override
public void initGui() {
    super.initGui();
    extractButton = new Button(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(13, 164, 60, 16)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            extractDimlets();
        }
    }).setTooltips("Extract the dimlets out of", "a realized dimension tab");
    storeButton = new Button(mc, this).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(13, 182, 60, 16)).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            storeDimlets();
        }
    }).setTooltips("Store dimlets in a", "empty dimension tab");
    nameField = new TextField(mc, this).addTextEvent(new TextEvent() {

        @Override
        public void textChanged(Widget parent, String newText) {
            storeName(newText);
        }
    }).setLayoutHint(new PositionalLayout.PositionalHint(13, 200, 60, 16));
    validateField = new Label(mc, this).setText("Val");
    validateField.setTooltips("Hover here for errors...");
    validateField.setLayoutHint(new PositionalLayout.PositionalHint(35, 142, 38, 16));
    setNameFromDimensionTab();
    Widget toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(storeButton).addChild(nameField).addChild(validateField);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) TextEvent(mcjty.lib.gui.events.TextEvent) Label(mcjty.lib.gui.widgets.Label) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) TextField(mcjty.lib.gui.widgets.TextField)

Aggregations

Window (mcjty.lib.gui.Window)2 ButtonEvent (mcjty.lib.gui.events.ButtonEvent)2 Button (mcjty.lib.gui.widgets.Button)2 Label (mcjty.lib.gui.widgets.Label)2 Panel (mcjty.lib.gui.widgets.Panel)2 TextEvent (mcjty.lib.gui.events.TextEvent)1 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)1 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)1 TextField (mcjty.lib.gui.widgets.TextField)1