Search in sources :

Example 21 with Window

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

the class GuiTimer 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("Delay:");
    speedField = new TextField(mc, this).setTooltips("Set the delay in ticks", "(20 ticks is one second)").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(label).addChild(speedField);
    toplevel.addChild(bottomPanel);
    redstonePauses = new ToggleButton(mc, this).setText("Pause while redstone active").setDesiredHeight(16).setCheckMarker(true).setPressed(tileEntity.getRedstonePauses()).addButtonEvent(parent -> setRedstonePauses());
    toplevel.addChild(redstonePauses);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, TIMER_WIDTH, TIMER_HEIGHT));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) 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) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) 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 22 with Window

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

the class GuiRedstoneReceiver method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    analog = new ToggleButton(mc, this).setText("Analog mode").setTooltips("Output the same power", "level as the input, instead", "of always 15 or 0").setCheckMarker(true).setDesiredWidth(160).setDesiredHeight(16).setPressed(tileEntity.getAnalog()).addButtonEvent(parent -> setAnalog());
    toplevel.addChild(analog);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, REDSTONE_RECEIVER_WIDTH, REDSTONE_RECEIVER_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) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout)

Example 23 with Window

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

the class GuiComposer method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    ShapeModifier[] modifiers = tileEntity.getModifiers();
    operationLabels[0] = null;
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        operationLabels[i] = new ChoiceLabel(mc, this).addChoices(ShapeOperation.UNION.getCode(), ShapeOperation.SUBTRACT.getCode(), ShapeOperation.INTERSECT.getCode());
        for (ShapeOperation operation : ShapeOperation.values()) {
            operationLabels[i].setChoiceTooltip(operation.getCode(), operation.getDescription());
        }
        operationLabels[i].setLayoutHint(new PositionalLayout.PositionalHint(55, 7 + i * 18, 26, 16));
        operationLabels[i].setChoice(modifiers[i].getOperation().getCode());
        operationLabels[i].addChoiceEvent((parent, newChoice) -> update());
        toplevel.addChild(operationLabels[i]);
    }
    operationLabels[0].setEnabled(false);
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        configButton[i] = new Button(mc, this).setText("?");
        configButton[i].setLayoutHint(new PositionalLayout.PositionalHint(3, 7 + i * 18 + 2, 13, 12));
        int finalI = i;
        configButton[i].addButtonEvent(parent -> openCardGui(finalI));
        configButton[i].setTooltips("Click to open the card gui");
        toplevel.addChild(configButton[i]);
    }
    outConfigButton = new Button(mc, this).setText("?");
    outConfigButton.setLayoutHint(new PositionalLayout.PositionalHint(3, 200 + 2, 13, 12));
    outConfigButton.addButtonEvent(parent -> openCardGui(-1));
    outConfigButton.setTooltips("Click to open the card gui");
    toplevel.addChild(outConfigButton);
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 176);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 176);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 176);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    Panel sidePanel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(sideBackground);
    String[] tt = { "Drag left mouse button to rotate", "Shift drag left mouse to pan", "Use mouse wheel to zoom in/out", "Use middle click to reset rotation" };
    sidePanel.addChild(new Label<>(mc, this).setText("E").setColor(0xffff0000).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 175, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("W").setColor(0xffff0000).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 175, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("U").setColor(0xff00bb00).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 190, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("D").setColor(0xff00bb00).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 190, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("N").setColor(0xff0000ff).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(5, 205, 15, 15)));
    sidePanel.addChild(new Label<>(mc, this).setText("S").setColor(0xff0000ff).setTooltips(tt).setLayoutHint(new PositionalLayout.PositionalHint(40, 205, 15, 15)));
    for (int i = 0; i < ComposerContainer.SLOT_COUNT; i++) {
        ToggleButton flip = new ToggleButton(mc, this).setText("Flip").setCheckMarker(true).setLayoutHint(new PositionalLayout.PositionalHint(6, 7 + i * 18, 35, 16));
        flip.setPressed(modifiers[i].isFlipY());
        flip.addButtonEvent(parent -> update());
        sidePanel.addChild(flip);
        flipButtons[i] = flip;
        ChoiceLabel rot = new ChoiceLabel(mc, this).addChoices("None", "X", "Y", "Z").setChoice("None").setLayoutHint(new PositionalLayout.PositionalHint(45, 7 + i * 18, 35, 16));
        rot.setChoice(modifiers[i].getRotation().getCode());
        rot.addChoiceEvent((parent, newChoice) -> update());
        sidePanel.addChild(rot);
        rotationLabels[i] = rot;
    }
    sidePanel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, SIDEWIDTH, ySize));
    sideWindow = new Window(this, sidePanel);
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 24 with Window

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

the class GuiProjector method initSidePanel.

private void initSidePanel() {
    Panel sidePanel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(sideBackground);
    initRsPanel(sidePanel, 0, "S");
    initRsPanel(sidePanel, 1, "N");
    initRsPanel(sidePanel, 2, "E");
    initRsPanel(sidePanel, 3, "W");
    sidePanel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, SIDEWIDTH, ySize));
    sideWindow = new Window(this, sidePanel);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 25 with Window

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

the class GuiScanner method initGui.

@Override
public void initGui() {
    super.initGui();
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setHorizontal().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(8, 120, 70, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    initRedstoneMode();
    toplevel.addChild(redstoneMode);
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 176);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 176);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 176);
    scanButton = new Button(mc, this).setText("Scan").addButtonEvent(parent -> scan()).setLayoutHint(new PositionalLayout.PositionalHint(5, 156, 40, 16));
    toplevel.addChild(scanButton);
    toplevel.addChild(new Button(mc, this).setText("W").addButtonEvent(parent -> move(-16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("w").addButtonEvent(parent -> move(-1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("e").addButtonEvent(parent -> move(1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("E").addButtonEvent(parent -> move(16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("S").addButtonEvent(parent -> move(0, 0, -16)).setLayoutHint(new PositionalLayout.PositionalHint(4, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("s").addButtonEvent(parent -> move(0, 0, -1)).setLayoutHint(new PositionalLayout.PositionalHint(20, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("n").addButtonEvent(parent -> move(0, 0, 1)).setLayoutHint(new PositionalLayout.PositionalHint(45, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("N").addButtonEvent(parent -> move(0, 0, 16)).setLayoutHint(new PositionalLayout.PositionalHint(61, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("D").addButtonEvent(parent -> move(0, -16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("d").addButtonEvent(parent -> move(0, -1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("u").addButtonEvent(parent -> move(0, 1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("U").addButtonEvent(parent -> move(0, 16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 70, 16, 15)));
    offsetLabel = new Label(mc, this).setText("Off: " + BlockPosTools.toString(tileEntity.getDataOffset())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    offsetLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 90, 80, 14));
    toplevel.addChild(offsetLabel);
    dimensionLabel = new Label(mc, this).setText("Dim: " + BlockPosTools.toString(tileEntity.getDataDim())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    dimensionLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 105, 80, 14));
    toplevel.addChild(dimensionLabel);
    progressLabel = new Label(mc, this).setText("");
    progressLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 135, 80, 14));
    toplevel.addChild(progressLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    move(0, 0, 0);
    filterCnt = countFilters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

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