Search in sources :

Example 11 with Button

use of mcjty.lib.gui.widgets.Button in project RFTools by McJty.

the class GuiMatterReceiver method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setHorizontal().setDesiredHeight(12).setDesiredWidth(80).setMaxValue(maxEnergyStored).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    TextField textField = new TextField(mc, this).setTooltips("Use this name to", "identify this receiver", "in the dialer").addTextEvent((parent, newText) -> setReceiverName(newText));
    textField.setText(tileEntity.getName());
    Panel namePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Name:")).addChild(textField).setDesiredHeight(16);
    privateSetting = new ChoiceLabel(mc, this).addChoices(ACCESS_PUBLIC, ACCESS_PRIVATE).setDesiredHeight(14).setDesiredWidth(60).setChoiceTooltip(ACCESS_PUBLIC, "Everyone can dial to this receiver").setChoiceTooltip(ACCESS_PRIVATE, "Only people in the access list below", "can dial to this receiver").addChoiceEvent((parent, newChoice) -> changeAccessMode(newChoice));
    if (tileEntity.isPrivateAccess()) {
        privateSetting.setChoice(ACCESS_PRIVATE);
    } else {
        privateSetting.setChoice(ACCESS_PUBLIC);
    }
    Panel privatePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Access:")).addChild(privateSetting).setDesiredHeight(16);
    allowedPlayers = new WidgetList(mc, this);
    Slider allowedPlayerSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(allowedPlayers);
    Panel allowedPlayersPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(allowedPlayers).addChild(allowedPlayerSlider).setFilledBackground(0xff9e9e9e);
    nameField = new TextField(mc, this);
    addButton = new Button(mc, this).setText("Add").setDesiredHeight(13).setDesiredWidth(34).setTooltips("Add a player to the access list").addButtonEvent(parent -> addPlayer());
    delButton = new Button(mc, this).setText("Del").setDesiredHeight(13).setDesiredWidth(34).setTooltips("Remove the selected player", "from the access list").addButtonEvent(parent -> delPlayer());
    Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(nameField).addChild(addButton).addChild(delButton).setDesiredHeight(16);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setHorizontalMargin(3).setVerticalMargin(3).setSpacing(1)).addChild(energyBar).addChild(namePanel).addChild(privatePanel).addChild(allowedPlayersPanel).addChild(buttonPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, MATTER_WIDTH, MATTER_HEIGHT));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    listDirty = 0;
    requestPlayers();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) java.util(java.util) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) PacketGetPlayers(mcjty.rftools.network.PacketGetPlayers) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) Keyboard(org.lwjgl.input.Keyboard) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) StyleConfig(mcjty.lib.base.StyleConfig) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) List(java.util.List) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout)

Example 12 with Button

use of mcjty.lib.gui.widgets.Button 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 13 with Button

use of mcjty.lib.gui.widgets.Button 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)

Example 14 with Button

use of mcjty.lib.gui.widgets.Button in project RFToolsDimensions by McJty.

the class GuiDimletWorkbench method initGui.

@Override
public void initGui() {
    super.initGui();
    searchBar = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 7, 128, 16)).addTextEvent((widget, string) -> {
        itemList.setSelected(-1);
        listDirty = true;
    });
    itemList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 25, 118, 108)).setLeftMargin(0).setRowheight(-1).addSelectionEvent(new SelectionEvent() {

        @Override
        public void select(Widget widget, int i) {
        }

        @Override
        public void doubleClick(Widget widget, int i) {
            suggestParts();
        }
    });
    slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(239, 25, 9, 108)).setDesiredWidth(11).setVertical().setScrollable(itemList);
    int maxEnergyStored = tileEntity.getMaxEnergyStored(EnumFacing.DOWN);
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(80, 9, 38, 10)).setShowText(false).setHorizontal();
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    extractButton = new Button(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 48, 14)).addButtonEvent(parent -> extractDimlet()).setTooltips("Deconstruct a dimlet into its parts");
    Widget toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(energyBar).addChild(itemList).addChild(slider).addChild(searchBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    listDirty = true;
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsDimMessages(mcjty.rftoolsdim.network.RFToolsDimMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) DimletCraftingTools(mcjty.rftoolsdim.dimensions.dimlets.types.DimletCraftingTools) Label(mcjty.lib.gui.widgets.Label) KnownDimletConfiguration(mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Panel(mcjty.lib.gui.widgets.Panel) RFToolsDim(mcjty.rftoolsdim.RFToolsDim) Map(java.util.Map) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModItems(mcjty.rftoolsdim.items.ModItems) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) EnumFacing(net.minecraft.util.EnumFacing) Settings(mcjty.rftoolsdim.config.Settings) Mouse(org.lwjgl.input.Mouse) Collectors(java.util.stream.Collectors) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) Button(mcjty.lib.gui.widgets.Button) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextField(mcjty.lib.gui.widgets.TextField)

Example 15 with Button

use of mcjty.lib.gui.widgets.Button in project RFTools by McJty.

the class GuiScreenController method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Button scanButton = new Button(mc, this).setText("Scan").setTooltips("Find all nearby screens", "and connect to them").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 50, 14));
    scanButton.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenControllerTileEntity.CMD_SCAN));
    Button detachButton = new Button(mc, this).setText("Detach").setTooltips("Detach from all screens").setLayoutHint(new PositionalLayout.PositionalHint(90, 7, 50, 14));
    detachButton.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenControllerTileEntity.CMD_DETACH));
    infoLabel = new Label(mc, this);
    infoLabel.setLayoutHint(new PositionalLayout.PositionalHint(30, 25, 140, 14));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(scanButton).addChild(detachButton).addChild(infoLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Aggregations

Button (mcjty.lib.gui.widgets.Button)30 Panel (mcjty.lib.gui.widgets.Panel)27 Window (mcjty.lib.gui.Window)24 Label (mcjty.lib.gui.widgets.Label)24 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)17 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)17 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)15 java.awt (java.awt)14 TextField (mcjty.lib.gui.widgets.TextField)14 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)13 ResourceLocation (net.minecraft.util.ResourceLocation)11 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)10 List (java.util.List)9 RFTools (mcjty.rftools.RFTools)9 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)8 Argument (mcjty.lib.network.Argument)8 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)8 StyleConfig (mcjty.lib.base.StyleConfig)7 GenericEnergyStorageTileEntity (mcjty.lib.entity.GenericEnergyStorageTileEntity)7 IOException (java.io.IOException)6