use of mcjty.lib.gui.events.SelectionEvent in project RFToolsDimensions by McJty.
the class GuiDimletWorkbench method initGui.
@Override
public void initGui() {
super.initGui();
searchBar = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 7, 128, 16)).addTextEvent((widget, string) -> {
itemList.setSelected(-1);
listDirty = true;
});
itemList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 25, 118, 133)).setLeftMargin(0).setRowheight(-1).addSelectionEvent(new SelectionEvent() {
@Override
public void select(Widget widget, int i) {
}
@Override
public void doubleClick(Widget widget, int i) {
EntityPlayerSP player = Minecraft.getMinecraft().player;
if (player.isCreative() && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
cheatDimlet();
} else {
suggestParts();
}
}
});
slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(239, 25, 9, 133)).setDesiredWidth(11).setVertical().setScrollable(itemList);
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(88, 9, 30, 10)).setShowText(false).setHorizontal();
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
extractButton = new ToggleButton(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 56, 14)).setCheckMarker(true).addButtonEvent(parent -> setExtractMode()).setTooltips("If on dimlets will be reconstructed into parts");
extractButton.setPressed(tileEntity.isExtractMode());
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(energyBar).addChild(itemList).addChild(slider).addChild(searchBar);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
listDirty = true;
window = new Window(this, toplevel);
}
Aggregations