Search in sources :

Example 6 with Panel

use of mcjty.lib.gui.widgets.Panel in project RFToolsDimensions by McJty.

the class GuiDimletWorkbench method addItemToList.

private void addItemToList(DimletKey key, WidgetList itemList) {
    Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setDesiredWidth(116).setDesiredHeight(16);
    panel.setUserObject(key);
    itemList.addChild(panel);
    BlockRender blockRender = new BlockRender(mc, this).setRenderItem(KnownDimletConfiguration.getDimletStack(key)).setLayoutHint(new PositionalLayout.PositionalHint(1, 0, 16, 16)).setUserObject(key);
    panel.addChild(blockRender);
    String displayName = KnownDimletConfiguration.getDisplayName(key);
    AbstractWidget label = new Label(mc, this).setText(displayName).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(20, 0, 95, 16)).setUserObject(key);
    panel.addChild(label);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Example 7 with Panel

use of mcjty.lib.gui.widgets.Panel 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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsDimMessages(mcjty.rftoolsdim.network.RFToolsDimMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) DimletCraftingTools(mcjty.rftoolsdim.dimensions.dimlets.types.DimletCraftingTools) Keyboard(org.lwjgl.input.Keyboard) Label(mcjty.lib.gui.widgets.Label) KnownDimletConfiguration(mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Panel(mcjty.lib.gui.widgets.Panel) RFToolsDim(mcjty.rftoolsdim.RFToolsDim) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModItems(mcjty.rftoolsdim.items.ModItems) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextFormatting(net.minecraft.util.text.TextFormatting) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) Settings(mcjty.rftoolsdim.config.Settings) Mouse(org.lwjgl.input.Mouse) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextField(mcjty.lib.gui.widgets.TextField) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 8 with Panel

use of mcjty.lib.gui.widgets.Panel in project RFToolsDimensions by McJty.

the class GuiDimensionEnscriber method initGui.

@Override
public void initGui() {
    super.initGui();
    extractButton = new Button(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(13, 164, 60, 16)).addButtonEvent(parent -> {
        extractDimlets();
    }).setTooltips("Extract the dimlets out of", "a realized dimension tab");
    storeButton = new Button(mc, this).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(13, 182, 60, 16)).addButtonEvent(parent -> {
        storeDimlets();
    }).setTooltips("Store dimlets in a", "empty dimension tab");
    nameField = new TextField(mc, this).addTextEvent((parent, newText) -> {
        storeName(newText);
    }).setLayoutHint(new PositionalLayout.PositionalHint(13, 200, 60, 16));
    validateField = new Label(mc, this).setText("Val");
    validateField.setTooltips("Hover here for errors...");
    validateField.setLayoutHint(new PositionalLayout.PositionalHint(35, 142, 38, 16));
    setNameFromDimensionTab();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(storeButton).addChild(nameField).addChild(validateField);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Aggregations

Label (mcjty.lib.gui.widgets.Label)8 Panel (mcjty.lib.gui.widgets.Panel)8 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)7 Window (mcjty.lib.gui.Window)6 Button (mcjty.lib.gui.widgets.Button)3 TextField (mcjty.lib.gui.widgets.TextField)3 java.awt (java.awt)2 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)2 RFToolsDim (mcjty.rftoolsdim.RFToolsDim)2 Minecraft (net.minecraft.client.Minecraft)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 Mouse (org.lwjgl.input.Mouse)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Locale (java.util.Locale)1 StyleConfig (mcjty.lib.base.StyleConfig)1 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)1 GenericEnergyStorageTileEntity (mcjty.lib.entity.GenericEnergyStorageTileEntity)1 SelectionEvent (mcjty.lib.gui.events.SelectionEvent)1