Search in sources :

Example 46 with HorizontalLayout

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

the class GuiMatterTransmitter 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 transmitter", "in the dialer").addTextEvent((parent, newText) -> setTransmitterName(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 access this transmitter", "and change the dialing destination").setChoiceTooltip(ACCESS_PRIVATE, "Only people in the access list below", "can access this transmitter").addChoiceEvent((parent, newChoice) -> changeAccessMode(newChoice));
    if (tileEntity.isPrivateAccess()) {
        privateSetting.setChoice(ACCESS_PRIVATE);
    } else {
        privateSetting.setChoice(ACCESS_PUBLIC);
    }
    beamToggle = new ToggleButton(mc, this).setText("Hide").setCheckMarker(true).setDesiredHeight(14).setDesiredWidth(49).setTooltips("Hide the teleportation beam").addButtonEvent(parent -> changeBeamState()).setPressed(tileEntity.isBeamHidden());
    Panel privatePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Access:")).addChild(privateSetting).addChild(beamToggle).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 47 with HorizontalLayout

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

the class GuiStorageScanner method addStorageLine.

private void addStorageLine(InventoriesInfoPacketClient.InventoryInfo c, String displayName, boolean routable) {
    Panel panel;
    if (c == null) {
        panel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(8).setHorizontalMargin(5));
        panel.addChild(new ImageLabel(mc, this).setImage(guielements, 115, 19).setDesiredWidth(13).setDesiredHeight(13));
    } else {
        HorizontalLayout layout = new HorizontalLayout();
        if (!openViewButton.isPressed()) {
            layout.setHorizontalMargin(2);
        }
        panel = new Panel(mc, this).setLayout(layout);
        panel.addChild(new BlockRender(mc, this).setRenderItem(c.getBlock()));
    }
    if (openViewButton.isPressed()) {
        AbstractWidget label;
        label = new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(displayName).setDynamic(true).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(58);
        if (c == null) {
            label.setTooltips(TextFormatting.GREEN + "All routable inventories").setDesiredWidth(74);
        } else {
            label.setTooltips(TextFormatting.GREEN + "Block at: " + TextFormatting.WHITE + BlockPosTools.toString(c.getPos()), TextFormatting.GREEN + "Name: " + TextFormatting.WHITE + displayName, "(doubleclick to highlight)");
        }
        panel.addChild(label);
        if (c != null) {
            ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeRoutable(c.getPos())).setDesiredWidth(13);
            choiceLabel.addChoice("No", "Not routable", guielements, 131, 19);
            choiceLabel.addChoice("Yes", "Routable", guielements, 115, 19);
            choiceLabel.setCurrentChoice(routable ? 1 : 0);
            panel.addChild(choiceLabel);
        }
    }
    storageList.addChild(panel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) BlockRenderEvent(mcjty.lib.gui.events.BlockRenderEvent) TextField(mcjty.lib.gui.widgets.TextField) java.util(java.util) 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) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) BlockPosTools(mcjty.lib.varia.BlockPosTools) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Panel(mcjty.lib.gui.widgets.Panel) MutablePair(org.apache.commons.lang3.tuple.MutablePair) Pair(org.apache.commons.lang3.tuple.Pair) Logging(mcjty.lib.varia.Logging) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) PacketGetInfoFromServer(mcjty.lib.network.clientinfo.PacketGetInfoFromServer) RFTools(mcjty.rftools.RFTools) Predicate(java.util.function.Predicate) GhostOutputSlot(mcjty.lib.container.GhostOutputSlot) TextFormatting(net.minecraft.util.text.TextFormatting) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Mouse(org.lwjgl.input.Mouse) 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) CommandHandler(mcjty.rftools.CommandHandler) GuiCraftingGrid(mcjty.rftools.craftinggrid.GuiCraftingGrid) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 48 with HorizontalLayout

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

the class GuiElevator 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 floor").addTextEvent((parent, newText) -> updateName());
    nameField.setText(tileEntity.getName());
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Name:")).addChild(nameField);
    toplevel.addChild(bottomPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
    window = new Window(this, toplevel);
}
Also used : EmptyContainer(mcjty.lib.container.EmptyContainer) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) Window(mcjty.lib.gui.Window) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) 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 49 with HorizontalLayout

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

the class GuiEnderMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    Label label = new Label(mc, this).setText("Mode:");
    initGuiMode();
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(label).addChild(mode);
    toplevel.addChild(bottomPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, MONITOR_WIDTH, MONITOR_HEIGHT));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 50 with HorizontalLayout

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

the class GuiEndergenic method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setHorizontal().setDesiredHeight(12).setMaxValue(maxEnergyStored).setShowText(true);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Label descriptionLabel = new Label(mc, this).setText("Averages over last 5 seconds:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    lastRfPerTick = new TextField(mc, this).setText("0 RF/tick").setDesiredWidth(90).setDesiredHeight(14);
    Panel p1 = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Gain:").setDesiredWidth(70)).addChild(lastRfPerTick);
    lastLostPearls = new TextField(mc, this).setText("0").setDesiredWidth(90).setDesiredHeight(14);
    Panel p2 = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Lost:").setDesiredWidth(70)).addChild(lastLostPearls);
    lastLaunchedPearls = new TextField(mc, this).setText("0").setDesiredWidth(90).setDesiredHeight(14);
    Panel p3 = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Launched:").setDesiredWidth(70)).addChild(lastLaunchedPearls);
    lastOpportunities = new TextField(mc, this).setText("0").setDesiredWidth(90).setDesiredHeight(14);
    Panel p4 = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Chances:").setDesiredWidth(70)).addChild(lastOpportunities);
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(energyBar).addChild(descriptionLabel).addChild(p1).addChild(p2).addChild(p3).addChild(p4);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, ENDERGENIC_WIDTH, ENDERGENIC_HEIGHT));
    window = new mcjty.lib.gui.Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) TextField(mcjty.lib.gui.widgets.TextField) 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