Search in sources :

Example 51 with Window

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

the class GuiSequencer method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    initGuiGrid(toplevel);
    Button clearButton = new Button(mc, this).setText("Clear").setTooltips("Clear the grid").setDesiredHeight(13).setDesiredWidth(38).addButtonEvent(parent -> fillGrid());
    Button flipButton = new Button(mc, this).setText("Flip").setTooltips("Invert all values in the grid").setDesiredHeight(13).setDesiredWidth(34).addButtonEvent(parent -> flipGrid());
    Label endLabel = new Label(mc, this).setText("End on:");
    ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> setEndState(newChoice)).setDesiredHeight(11).addChoice("0", "Disabled", iconGuiElements, 160, 0).addChoice("1", "Enabled", iconGuiElements, 176, 0);
    choiceLabel.setCurrentChoice(tileEntity.getEndState() ? 1 : 0);
    Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(clearButton).addChild(flipButton).addChild(endLabel).addChild(choiceLabel);
    toplevel.addChild(buttonPanel);
    initGuiMode();
    Label speedLabel = new Label(mc, this).setText("Delay:");
    speedField = new TextField(mc, this).addTextEvent((parent, newText) -> setDelay());
    int delay = tileEntity.getDelay();
    if (delay <= 0) {
        delay = 1;
    }
    speedField.setText(String.valueOf(delay));
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(mode).addChild(speedLabel).addChild(speedField);
    toplevel.addChild(bottomPanel);
    Label countLabel = new Label(mc, this).setText("Sequence length:");
    countField = new TextField(mc, this).addTextEvent((parent, newText) -> setCount());
    int count = tileEntity.getStepCount();
    if (count < 1 || count > 64) {
        count = 64;
    }
    countField.setText(String.valueOf(count));
    Panel countPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(countLabel).addChild(countField);
    toplevel.addChild(countPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, SEQUENCER_WIDTH, SEQUENCER_HEIGHT));
    window = new Window(this, toplevel);
}
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) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) 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) ResourceLocation(net.minecraft.util.ResourceLocation) RFTools(mcjty.rftools.RFTools) 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) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 52 with Window

use of mcjty.lib.gui.Window 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 53 with Window

use of mcjty.lib.gui.Window 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 54 with Window

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

the class GuiInvChecker method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    amountField = new TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14)).addTextEvent((parent, newText) -> setAmount());
    int amount = tileEntity.getAmount();
    amountField.setText(String.valueOf(amount));
    slotField = new TextField(mc, this).setTooltips("Set the slot index").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setSlot());
    int current = tileEntity.getSlot();
    slotField.setText(String.valueOf(current));
    metaLabel = new ChoiceLabel(mc, this).addChoices(META_IGNORE, META_MATCH).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(META_IGNORE, "Ignore meta/damage on item").setChoiceTooltip(META_MATCH, "Meta/damage on item must match");
    metaLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
    metaLabel.setChoice(tileEntity.isUseMeta() ? META_MATCH : META_IGNORE);
    oreDictLabel = new ChoiceLabel(mc, this).addChoices(OREDICT_IGNORE, OREDICT_USE).addChoiceEvent((parent, newChoice) -> setOredictUsage()).setChoiceTooltip(OREDICT_IGNORE, "Ingore ore dictionary").setChoiceTooltip(OREDICT_USE, "Use ore dictionary matching");
    oreDictLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 51, 80, 14));
    oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
    toplevel.addChild(new Label(mc, this).setText("Slot:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(slotField).addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Meta:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(metaLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 51, 50, 14))).addChild(oreDictLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) Window(mcjty.lib.gui.Window) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) TextField(mcjty.lib.gui.widgets.TextField)

Example 55 with Window

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

the class GuiCoalGenerator 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());
    initRedstoneMode();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(redstoneMode);
    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)

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