Search in sources :

Example 1 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout 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(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) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) GuiScreen(net.minecraft.client.gui.GuiScreen) Panel(mcjty.lib.gui.widgets.Panel) RFToolsDim(mcjty.rftoolsdim.RFToolsDim) Minecraft(net.minecraft.client.Minecraft) Locale(java.util.Locale) 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)

Example 2 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiEnvironmentalController method initAreaPanel.

private Panel initAreaPanel() {
    int r = tileEntity.getRadius();
    if (r < 5) {
        r = 5;
    } else if (r > 100) {
        r = 100;
    }
    int miny = tileEntity.getMiny();
    int maxy = tileEntity.getMaxy();
    Panel areaPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(28, 6, ENV_WIDTH - 33, 37)).setLayout(new VerticalLayout().setVerticalMargin(2).setSpacing(0)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16);
    ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent((parent, newValue) -> sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue)));
    Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
    radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
    Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(17);
    minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent((parent, newText) -> sendBounds(true));
    maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent((parent, newText) -> sendBounds(false));
    minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
    areaPanel.addChild(radiusPanel).addChild(minPanel);
    return areaPanel;
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) 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) RedstoneMode(mcjty.lib.varia.RedstoneMode) Keyboard(org.lwjgl.input.Keyboard) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) RFTools(mcjty.rftools.RFTools) Argument(mcjty.lib.network.Argument) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 3 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiEnvironmentalController method initPlayerPanel.

private Panel initPlayerPanel() {
    playersList = new WidgetList(mc, this);
    Slider playerSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(playersList);
    return new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 42, ENV_WIDTH - 27, 78)).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(playersList).addChild(playerSlider);
}
Also used : HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 4 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiCounter method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    counterField = new TextField(mc, this).setTooltips("Set the counter in pulses").addTextEvent((parent, newText) -> setCounter());
    int delay = tileEntity.getCounter();
    if (delay <= 0) {
        delay = 1;
    }
    counterField.setText(String.valueOf(delay));
    currentField = new TextField(mc, this).setTooltips("Set the current value", "(fires when it reaches counter)").addTextEvent((parent, newText) -> setCurrent());
    int current = tileEntity.getCurrent();
    if (current < 0) {
        current = 0;
    }
    currentField.setText(String.valueOf(current));
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Counter:")).addChild(counterField).addChild(new Label(mc, this).setText("Current:")).addChild(currentField);
    toplevel.addChild(bottomPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, COUNTER_WIDTH, COUNTER_HEIGHT));
    window = new Window(this, toplevel);
    requestCurrentCounter();
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) Arguments(mcjty.lib.network.Arguments) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) CommandHandler(mcjty.rftools.CommandHandler) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) Rectangle(java.awt.Rectangle) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 5 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.

the class GuiStorageScanner method addItemToList.

private Pair<Panel, Integer> addItemToList(ItemStack item, WidgetList itemList, Pair<Panel, Integer> currentPos, int numcolumns, int spacing) {
    Panel panel = currentPos.getKey();
    if (panel == null || currentPos.getValue() >= numcolumns) {
        panel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(spacing).setHorizontalMargin(1)).setDesiredHeight(12).setUserObject(new Integer(-1)).setDesiredHeight(16);
        currentPos = MutablePair.of(panel, 0);
        itemList.addChild(panel);
    }
    BlockRender blockRender = new BlockRender(mc, this).setRenderItem(item).setUserObject(// Mark as a special stack in the renderer (for tooltip)
    1).setOffsetX(-1).setOffsetY(-1).setHilightOnHover(true);
    blockRender.addSelectionEvent(new BlockRenderEvent() {

        @Override
        public void select(Widget widget) {
            BlockRender br = (BlockRender) widget;
            Object item = br.getRenderItem();
            if (item != null) {
                boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
                requestItem((ItemStack) item, shift ? 1 : -1);
            }
        }

        @Override
        public void doubleClick(Widget widget) {
        }
    });
    panel.addChild(blockRender);
    currentPos.setValue(currentPos.getValue() + 1);
    return currentPos;
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) BlockRenderEvent(mcjty.lib.gui.events.BlockRenderEvent) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Aggregations

HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)75 Panel (mcjty.lib.gui.widgets.Panel)55 Window (mcjty.lib.gui.Window)38 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)32 TextField (mcjty.lib.gui.widgets.TextField)25 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)24 java.awt (java.awt)21 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)21 List (java.util.List)20 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)20 Button (mcjty.lib.gui.widgets.Button)20 Argument (mcjty.lib.network.Argument)19 RFTools (mcjty.rftools.RFTools)19 BlockPos (net.minecraft.util.math.BlockPos)19 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 StyleConfig (mcjty.lib.base.StyleConfig)16 ResourceLocation (net.minecraft.util.ResourceLocation)15 Minecraft (net.minecraft.client.Minecraft)14 EmptyContainer (mcjty.lib.container.EmptyContainer)13