use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools 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(RFTools.instance, mc, this).setText(manualText).setArrowImage(iconGuiElements, 144, 0).setCraftingGridImage(iconGuiElements, 0, 192);
prevButton = new Button(mc, this).setText("<").addButtonEvent(parent -> {
// System.out.println("GuiRFToolsManual.buttonClicked: <");
textPage.prevPage();
window.setTextFocus(textPage);
});
pageLabel = new Label(mc, this).setText("0 / 0");
nextButton = new Button(mc, this).setText(">").addButtonEvent(parent -> {
// System.out.println("GuiRFToolsManual.buttonClicked: >");
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;
}
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiAdvancedPorter method createPanel.
private Panel createPanel(final TextField destination, final int i) {
return new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(destination).addChild(new Button(mc, this).setText("Set").setDesiredWidth(30).setDesiredHeight(16).addButtonEvent(parent -> {
if (targets[i] != -1) {
RFToolsMessages.sendToServer(CommandHandler.CMD_SET_TARGET, Arguments.builder().value(targets[i]));
target = targets[i];
}
})).addChild(new Button(mc, this).setText("Clear").setDesiredWidth(40).setDesiredHeight(16).addButtonEvent(parent -> {
if (targets[i] != -1 && targets[i] == target) {
target = -1;
}
RFToolsMessages.sendToServer(CommandHandler.CMD_CLEAR_TARGET, Arguments.builder().value(i));
targets[i] = -1;
})).setDesiredHeight(16);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiTeleportProbe method initGui.
@Override
public void initGui() {
super.initGui();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void doubleClick(Widget parent, int index) {
teleport(index);
}
});
Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(list);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(list).addChild(listSlider);
toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
window = new Window(this, toplevel);
serverDestinationList = null;
destinationList = null;
requestReceiversFromServer();
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiNetworkMonitor method initGui.
@Override
public void initGui() {
super.initGui();
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void doubleClick(Widget parent, int index) {
hilightBlock(index);
}
});
listDirty = 0;
Slider listSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(list);
Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(list).addChild(listSlider);
showRfPerTick = new ToggleButton(mc, this).setCheckMarker(true).setText("RF/tick").setDesiredWidth(80).addButtonEvent(parent -> previousRfMillis = 0).setDesiredHeight(14);
filterTextField = new TextField(mc, this).setDesiredHeight(14).addTextEvent((parent, newText) -> {
filter = filterTextField.getText();
if (filter.trim().isEmpty()) {
filter = null;
}
connectedBlocks = null;
});
Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(showRfPerTick).addChild(new Label(mc, this).setText("Filter:")).addChild(filterTextField).setDesiredHeight(17);
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setVerticalMargin(3)).addChild(listPanel).addChild(buttonPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
serverConnectedBlocks = null;
}
use of mcjty.lib.gui.layout.HorizontalLayout 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);
}
Aggregations