Search in sources :

Example 61 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiMatterBeamer 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());
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
    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) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) EnergyBar(mcjty.lib.gui.widgets.EnergyBar)

Example 62 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiSpawner 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());
    blocks[0] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 5, 18, 18));
    blocks[1] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 25, 18, 18));
    blocks[2] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(80, 45, 18, 18));
    labels[0] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[0].setLayoutHint(new PositionalLayout.PositionalHint(100, 5, 74, 18));
    labels[1] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[1].setLayoutHint(new PositionalLayout.PositionalHint(100, 25, 74, 18));
    labels[2] = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    labels[2].setLayoutHint(new PositionalLayout.PositionalHint(100, 45, 74, 18));
    name = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    name.setLayoutHint(new PositionalLayout.PositionalHint(22, 31, 78, 16));
    rfTick = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    rfTick.setLayoutHint(new PositionalLayout.PositionalHint(22, 47, 78, 16));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(blocks[0]).addChild(labels[0]).addChild(blocks[1]).addChild(labels[1]).addChild(blocks[2]).addChild(labels[2]).addChild(rfTick).addChild(name);
    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) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Example 63 with Window

use of mcjty.lib.gui.Window in project XNet by McJty.

the class GuiRouter method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackgrounds(sideBackground, mainBackground).setBackgroundLayout(true, SIDEWIDTH);
    toplevel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, xSize + SIDEWIDTH, ySize));
    toplevel.addChild(initLocalChannelListPanel());
    toplevel.addChild(initRemoteChannelListPanel());
    toplevel.addChild(new Label<>(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Local Channels").setColor(0xff2244aa).setLayoutHint(new PositionalLayout.PositionalHint(6, 8, 166, 13)));
    toplevel.addChild(new Label<>(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Remote Channels").setColor(0xff2244aa).setLayoutHint(new PositionalLayout.PositionalHint(172, 8, 164, 13)));
    window = new Window(this, toplevel);
    refresh();
    listDirty = 0;
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 64 with Window

use of mcjty.lib.gui.Window in project XNet by McJty.

the class GuiConnector method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    nameField = new TextField(mc, this).setTooltips("Set the name of this connector").addTextEvent((parent, newText) -> updateName());
    nameField.setText(tileEntity.getConnectorName());
    Panel namePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Name:")).addChild(nameField);
    toplevel.addChild(namePanel);
    Panel togglePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Directions:"));
    for (EnumFacing facing : EnumFacing.VALUES) {
        toggleButtons[facing.ordinal()] = new ToggleButton(mc, this).setText(facing.getName().substring(0, 1).toUpperCase()).addButtonEvent(parent -> {
            sendServerCommand(XNetMessages.INSTANCE, ConnectorTileEntity.CMD_ENABLE, new Argument("facing", facing.ordinal()), new Argument("enabled", toggleButtons[facing.ordinal()].isPressed()));
        });
        toggleButtons[facing.ordinal()].setPressed(tileEntity.isEnabled(facing));
        togglePanel.addChild(toggleButtons[facing.ordinal()]);
    }
    toplevel.addChild(togglePanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) TextField(mcjty.lib.gui.widgets.TextField) EnumFacing(net.minecraft.util.EnumFacing) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) XNet(mcjty.xnet.XNet) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) GuiProxy(mcjty.xnet.gui.GuiProxy) Panel(mcjty.lib.gui.widgets.Panel) XNetMessages(mcjty.xnet.network.XNetMessages) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) EnumFacing(net.minecraft.util.EnumFacing) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 65 with Window

use of mcjty.lib.gui.Window in project XNet by McJty.

the class GuiXNetManual 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(XNet.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);
    Panel 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) XNet(mcjty.xnet.XNet) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) GuiScreen(net.minecraft.client.gui.GuiScreen) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) 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)

Aggregations

Window (mcjty.lib.gui.Window)74 Panel (mcjty.lib.gui.widgets.Panel)57 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)48 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)29 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)28 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)24 Argument (mcjty.lib.network.Argument)24 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)23 java.awt (java.awt)22 Button (mcjty.lib.gui.widgets.Button)22 RFTools (mcjty.rftools.RFTools)22 TextField (mcjty.lib.gui.widgets.TextField)21 Rectangle (java.awt.Rectangle)20 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)20 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 ResourceLocation (net.minecraft.util.ResourceLocation)17 StyleConfig (mcjty.lib.base.StyleConfig)15 List (java.util.List)12 EmptyContainer (mcjty.lib.container.EmptyContainer)11