Search in sources :

Example 61 with HorizontalLayout

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

the class GuiLiquidMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            setSelectedBlock(index);
        }
    });
    listDirty = 0;
    Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
    Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
    alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent((parent, newChoice) -> changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice)));
    alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
    alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent((parent, newValue) -> changeAlarmValue(newValue));
    Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setMinimumKnobSize(15).setHorizontal().setTooltips("Alarm level").setScrollable(alarmLabel);
    Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    fromServer_clientAdjacentBlocks = new ArrayList<>();
    RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentTankBlocks(tileEntity.getPos()));
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) BlockPos(net.minecraft.util.math.BlockPos) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) BlockPosTools(mcjty.lib.varia.BlockPosTools) IBlockState(net.minecraft.block.state.IBlockState) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) List(java.util.List) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Block(net.minecraft.block.Block) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Rectangle(java.awt.Rectangle) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 62 with HorizontalLayout

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

the class GuiRFMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            setSelectedBlock(index);
        }
    });
    listDirty = 0;
    Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
    Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
    alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent((parent, newChoice) -> changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice)));
    alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
    alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent((parent, newValue) -> changeAlarmValue(newValue));
    Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setHorizontal().setMinimumKnobSize(15).setTooltips("Alarm level").setScrollable(alarmLabel);
    Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    fromServer_clientAdjacentBlocks = new ArrayList<>();
    RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentBlocks(tileEntity.getPos()));
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) BlockPos(net.minecraft.util.math.BlockPos) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) BlockPosTools(mcjty.lib.varia.BlockPosTools) IBlockState(net.minecraft.block.state.IBlockState) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) List(java.util.List) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Block(net.minecraft.block.Block) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Rectangle(java.awt.Rectangle) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 63 with HorizontalLayout

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

the class GuiShield method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    initVisibilityMode();
    initActionOptions();
    initTypeOptions();
    initRedstoneMode();
    initDamageType();
    filterList = new WidgetList(mc, this).setDesiredHeight(120).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            selectFilter();
        }
    });
    Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(120);
    Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 124)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
    Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(parent -> applyCamoToShield());
    // applyCamo.setEnabled(false);
    // applyCamo.setTooltips("Not implemented yet");   // @todo
    colorSelector = new ColorChoiceLabel(mc, this).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16));
    colorSelector.addColors(0x96ffc8);
    for (EnumDyeColor color : EnumDyeColor.values()) {
        colorSelector.addColors(color.getColorValue());
    }
    colorSelector.setCurrentColor(tileEntity.getShieldColor());
    colorSelector.addChoiceEvent((parent, newColor) -> sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor)));
    player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
    addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(parent -> addNewFilter());
    delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(parent -> removeSelectedFilter());
    upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(parent -> moveFilterUp());
    downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(parent -> moveFilterDown());
    Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 58, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Label lootingBonus = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setText("Looting:");
    lootingBonus.setTooltips("Insert dimensional shards", "for looting bonus").setLayoutHint(new PositionalLayout.PositionalHint(160, 118, 60, 18));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector).addChild(lootingBonus);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    listDirty = 0;
    requestFilters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) mcjty.rftools.blocks.shield.filters(mcjty.rftools.blocks.shield.filters) Panel(mcjty.lib.gui.widgets.Panel) Block(net.minecraft.block.Block) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) EnumDyeColor(net.minecraft.item.EnumDyeColor) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) EnumDyeColor(net.minecraft.item.EnumDyeColor) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) TextField(mcjty.lib.gui.widgets.TextField) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 64 with HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout 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 HorizontalLayout

use of mcjty.lib.gui.layout.HorizontalLayout 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

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