use of mcjty.lib.gui.widgets.Button in project RFToolsControl 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(RFToolsControl.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);
Widget<?> 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;
}
}
use of mcjty.lib.gui.widgets.Button in project RFToolsControl by McJty.
the class GuiTools method showMessage.
public static void showMessage(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title) {
Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
ask.setBounds(new Rectangle(x, y, 200, 40));
Window askWindow = windowManager.createModalWindow(ask);
ask.addChild(new Label(mc, gui).setText(title));
Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
buttons.addChild(new Button(mc, gui).setText("Cancel").addButtonEvent((parent -> {
windowManager.closeWindow(askWindow);
})));
ask.addChild(buttons);
}
use of mcjty.lib.gui.widgets.Button 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);
}
use of mcjty.lib.gui.widgets.Button in project RFTools by McJty.
the class GuiBuilder 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, 6, 8, 59)).setShowText(false);
energyBar.setValue(getCurrentRF());
initRedstoneMode();
configButton = new Button(mc, this).setText("?");
configButton.setLayoutHint(new PositionalLayout.PositionalHint(83, 12, 13, 12));
configButton.addButtonEvent(parent -> openCardGui());
configButton.setTooltips("Click to open the card gui");
currentLevel = new Button(mc, this);
currentLevel.setText("Y:").setTooltips("Current level the builder is at", TextFormatting.YELLOW + "Press to restart!").setLayoutHint(new PositionalLayout.PositionalHint(81, 31, 45, 13)).addButtonEvent(parent -> restart());
Panel positionPanel = setupPositionPanel();
Panel modePanel = setupModePanel();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(modePanel).addChild(positionPanel).addChild(configButton).addChild(currentLevel).addChild(redstoneMode);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
tileEntity.requestRfFromServer(RFTools.MODID);
tileEntity.requestCurrentLevel();
}
use of mcjty.lib.gui.widgets.Button in project RFTools by McJty.
the class GuiDialingDevice method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setHorizontal().setDesiredWidth(80).setDesiredHeight(12).setMaxValue(maxEnergyStored).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
Panel transmitterPanel = setupTransmitterPanel();
Panel receiverPanel = setupReceiverPanel();
dialButton = new Button(mc, this).setText("Dial").setTooltips("Start a connection between", "the selected transmitter", "and the selected receiver").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> dial(false));
dialOnceButton = new Button(mc, this).setText("Dial Once").setTooltips("Dial a connection for a", "single teleport").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> dial(true));
interruptButton = new Button(mc, this).setText("Interrupt").setTooltips("Interrupt a connection", "for the selected transmitter").setDesiredHeight(14).setDesiredWidth(65).addButtonEvent(parent -> interruptDial());
favoriteButton = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeShowFavorite()).setDesiredWidth(10).setDesiredHeight(10);
favoriteButton.addChoice("No", "Unfavorited receiver", guielements, 131, 19);
favoriteButton.addChoice("Yes", "Favorited receiver", guielements, 115, 19);
favoriteButton.setCurrentChoice(tileEntity.isShowOnlyFavorites() ? 1 : 0);
Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(dialButton).addChild(dialOnceButton).addChild(interruptButton).addChild(favoriteButton).setDesiredHeight(16);
analyzerAvailable = DialingDeviceTileEntity.isDestinationAnalyzerAvailable(mc.world, tileEntity.getPos());
statusButton = new Button(mc, this).setText("Check").setDesiredHeight(14).setDesiredWidth(65).setEnabled(analyzerAvailable).addButtonEvent(parent -> checkStatus());
if (analyzerAvailable) {
statusButton.setTooltips("Check the status of", "the selected receiver");
} else {
statusButton.setTooltips("Check the status of", "the selected receiver", "(needs an adjacent analyzer!)");
}
statusLabel = new Label(mc, this);
statusLabel.setDesiredWidth(170).setDesiredHeight(14).setFilledRectThickness(1);
Panel statusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(statusButton).addChild(statusLabel).setDesiredHeight(16);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setVerticalMargin(3).setSpacing(1)).addChild(energyBar).addChild(transmitterPanel).addChild(receiverPanel).addChild(buttonPanel).addChild(statusPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, DIALER_WIDTH, DIALER_HEIGHT));
window = new mcjty.lib.gui.Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
fromServer_receivers = null;
fromServer_transmitters = null;
listDirty = 0;
clearSelectedStatus();
requestReceivers();
requestTransmitters();
tileEntity.requestRfFromServer(RFTools.MODID);
}
Aggregations