use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsDimensions 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(RFToolsDim.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);
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 GuiEnvironmentalController method initAreaPanel.
private Panel initAreaPanel() {
int r = tileEntity.getRadius();
if (r < 5) {
r = 5;
} else if (r > 100) {
r = 100;
}
int miny = tileEntity.getMiny();
int maxy = tileEntity.getMaxy();
Panel areaPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(28, 6, ENV_WIDTH - 33, 37)).setLayout(new VerticalLayout().setVerticalMargin(2).setSpacing(0)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16);
ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent((parent, newValue) -> sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue)));
Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(17);
minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent((parent, newText) -> sendBounds(true));
maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent((parent, newText) -> sendBounds(false));
minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
areaPanel.addChild(radiusPanel).addChild(minPanel);
return areaPanel;
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiEnvironmentalController method initPlayerPanel.
private Panel initPlayerPanel() {
playersList = new WidgetList(mc, this);
Slider playerSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(playersList);
return new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 42, ENV_WIDTH - 27, 78)).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(playersList).addChild(playerSlider);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiCounter method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
counterField = new TextField(mc, this).setTooltips("Set the counter in pulses").addTextEvent((parent, newText) -> setCounter());
int delay = tileEntity.getCounter();
if (delay <= 0) {
delay = 1;
}
counterField.setText(String.valueOf(delay));
currentField = new TextField(mc, this).setTooltips("Set the current value", "(fires when it reaches counter)").addTextEvent((parent, newText) -> setCurrent());
int current = tileEntity.getCurrent();
if (current < 0) {
current = 0;
}
currentField.setText(String.valueOf(current));
Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Counter:")).addChild(counterField).addChild(new Label(mc, this).setText("Current:")).addChild(currentField);
toplevel.addChild(bottomPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, COUNTER_WIDTH, COUNTER_HEIGHT));
window = new Window(this, toplevel);
requestCurrentCounter();
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiStorageScanner method addItemToList.
private Pair<Panel, Integer> addItemToList(ItemStack item, WidgetList itemList, Pair<Panel, Integer> currentPos, int numcolumns, int spacing) {
Panel panel = currentPos.getKey();
if (panel == null || currentPos.getValue() >= numcolumns) {
panel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(spacing).setHorizontalMargin(1)).setDesiredHeight(12).setUserObject(new Integer(-1)).setDesiredHeight(16);
currentPos = MutablePair.of(panel, 0);
itemList.addChild(panel);
}
BlockRender blockRender = new BlockRender(mc, this).setRenderItem(item).setUserObject(// Mark as a special stack in the renderer (for tooltip)
1).setOffsetX(-1).setOffsetY(-1).setHilightOnHover(true);
blockRender.addSelectionEvent(new BlockRenderEvent() {
@Override
public void select(Widget widget) {
BlockRender br = (BlockRender) widget;
Object item = br.getRenderItem();
if (item != null) {
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
requestItem((ItemStack) item, shift ? 1 : -1);
}
}
@Override
public void doubleClick(Widget widget) {
}
});
panel.addChild(blockRender);
currentPos.setValue(currentPos.getValue() + 1);
return currentPos;
}
Aggregations