Search in sources :

Example 6 with Button

use of mcjty.lib.gui.widgets.Button in project RFToolsControl 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(RFToolsControl.instance, mc, this).setText(manualText).setArrowImage(iconGuiElements, 144, 0).setCraftingGridImage(iconGuiElements, 0, 192);
    prevButton = new Button(mc, this).setText("<").addButtonEvent(parent -> {
        textPage.prevPage();
        window.setTextFocus(textPage);
    });
    pageLabel = new Label(mc, this).setText("0 / 0");
    nextButton = new Button(mc, this).setText(">").addButtonEvent(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 : mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) IOException(java.io.IOException) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) Mouse(org.lwjgl.input.Mouse) Window(mcjty.lib.gui.Window) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) GuiScreen(net.minecraft.client.gui.GuiScreen) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) RFToolsControl(mcjty.rftoolscontrol.RFToolsControl) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 7 with Button

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

the class GuiTools method showMessage.

public static void showMessage(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title) {
    Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
    ask.setBounds(new Rectangle(x, y, 200, 40));
    Window askWindow = windowManager.createModalWindow(ask);
    ask.addChild(new Label(mc, gui).setText(title));
    Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
    buttons.addChild(new Button(mc, gui).setText("Cancel").addButtonEvent((parent -> {
        windowManager.closeWindow(askWindow);
    })));
    ask.addChild(buttons);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 8 with Button

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

the class GuiScanner method initGui.

@Override
public void initGui() {
    super.initGui();
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setHorizontal().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(8, 120, 70, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    initRedstoneMode();
    toplevel.addChild(redstoneMode);
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 176);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 176);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 176);
    scanButton = new Button(mc, this).setText("Scan").addButtonEvent(parent -> scan()).setLayoutHint(new PositionalLayout.PositionalHint(5, 156, 40, 16));
    toplevel.addChild(scanButton);
    toplevel.addChild(new Button(mc, this).setText("W").addButtonEvent(parent -> move(-16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("w").addButtonEvent(parent -> move(-1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("e").addButtonEvent(parent -> move(1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("E").addButtonEvent(parent -> move(16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("S").addButtonEvent(parent -> move(0, 0, -16)).setLayoutHint(new PositionalLayout.PositionalHint(4, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("s").addButtonEvent(parent -> move(0, 0, -1)).setLayoutHint(new PositionalLayout.PositionalHint(20, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("n").addButtonEvent(parent -> move(0, 0, 1)).setLayoutHint(new PositionalLayout.PositionalHint(45, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("N").addButtonEvent(parent -> move(0, 0, 16)).setLayoutHint(new PositionalLayout.PositionalHint(61, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("D").addButtonEvent(parent -> move(0, -16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("d").addButtonEvent(parent -> move(0, -1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("u").addButtonEvent(parent -> move(0, 1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("U").addButtonEvent(parent -> move(0, 16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 70, 16, 15)));
    offsetLabel = new Label(mc, this).setText("Off: " + BlockPosTools.toString(tileEntity.getDataOffset())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    offsetLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 90, 80, 14));
    toplevel.addChild(offsetLabel);
    dimensionLabel = new Label(mc, this).setText("Dim: " + BlockPosTools.toString(tileEntity.getDataDim())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    dimensionLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 105, 80, 14));
    toplevel.addChild(dimensionLabel);
    progressLabel = new Label(mc, this).setText("");
    progressLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 135, 80, 14));
    toplevel.addChild(progressLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    move(0, 0, 0);
    filterCnt = countFilters();
    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)

Example 9 with Button

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

the class GuiBuilder 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, 6, 8, 59)).setShowText(false);
    energyBar.setValue(getCurrentRF());
    initRedstoneMode();
    configButton = new Button(mc, this).setText("?");
    configButton.setLayoutHint(new PositionalLayout.PositionalHint(83, 12, 13, 12));
    configButton.addButtonEvent(parent -> openCardGui());
    configButton.setTooltips("Click to open the card gui");
    currentLevel = new Button(mc, this);
    currentLevel.setText("Y:").setTooltips("Current level the builder is at", TextFormatting.YELLOW + "Press to restart!").setLayoutHint(new PositionalLayout.PositionalHint(81, 31, 45, 13)).addButtonEvent(parent -> restart());
    Panel positionPanel = setupPositionPanel();
    Panel modePanel = setupModePanel();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(modePanel).addChild(positionPanel).addChild(configButton).addChild(currentLevel).addChild(redstoneMode);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
    tileEntity.requestCurrentLevel();
}
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)

Example 10 with Button

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

the class GuiDialingDevice method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setHorizontal().setDesiredWidth(80).setDesiredHeight(12).setMaxValue(maxEnergyStored).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Panel transmitterPanel = setupTransmitterPanel();
    Panel receiverPanel = setupReceiverPanel();
    dialButton = new Button(mc, this).setText("Dial").setTooltips("Start a connection between", "the selected transmitter", "and the selected receiver").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> dial(false));
    dialOnceButton = new Button(mc, this).setText("Dial Once").setTooltips("Dial a connection for a", "single teleport").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> dial(true));
    interruptButton = new Button(mc, this).setText("Interrupt").setTooltips("Interrupt a connection", "for the selected transmitter").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> interruptDial());
    favoriteButton = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeShowFavorite()).setDesiredWidth(10).setDesiredHeight(10);
    favoriteButton.addChoice("No", "Unfavorited receiver", guielements, 131, 19);
    favoriteButton.addChoice("Yes", "Favorited receiver", guielements, 115, 19);
    favoriteButton.setCurrentChoice(tileEntity.isShowOnlyFavorites() ? 1 : 0);
    Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(dialButton).addChild(dialOnceButton).addChild(interruptButton).addChild(favoriteButton).setDesiredHeight(16);
    analyzerAvailable = DialingDeviceTileEntity.isDestinationAnalyzerAvailable(mc.world, tileEntity.getPos());
    statusButton = new Button(mc, this).setText("Check").setDesiredHeight(14).setDesiredWidth(65).setEnabled(analyzerAvailable).addButtonEvent(parent -> checkStatus());
    if (analyzerAvailable) {
        statusButton.setTooltips("Check the status of", "the selected receiver");
    } else {
        statusButton.setTooltips("Check the status of", "the selected receiver", "(needs an adjacent analyzer!)");
    }
    statusLabel = new Label(mc, this);
    statusLabel.setDesiredWidth(170).setDesiredHeight(14).setFilledRectThickness(1);
    Panel statusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(statusButton).addChild(statusLabel).setDesiredHeight(16);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setVerticalMargin(3).setSpacing(1)).addChild(energyBar).addChild(transmitterPanel).addChild(receiverPanel).addChild(buttonPanel).addChild(statusPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, DIALER_WIDTH, DIALER_HEIGHT));
    window = new mcjty.lib.gui.Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    fromServer_receivers = null;
    fromServer_transmitters = null;
    listDirty = 0;
    clearSelectedStatus();
    requestReceivers();
    requestTransmitters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Keyboard(org.lwjgl.input.Keyboard) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) BlockPosTools(mcjty.lib.varia.BlockPosTools) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Panel(mcjty.lib.gui.widgets.Panel) Vec3d(net.minecraft.util.math.Vec3d) PacketRequestIntegerFromServer(mcjty.lib.network.PacketRequestIntegerFromServer) Logging(mcjty.lib.varia.Logging) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) BlockPos(net.minecraft.util.math.BlockPos) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) EmptyContainer(mcjty.lib.container.EmptyContainer) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout)

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