Search in sources :

Example 71 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiTools method askSomething.

public static void askSomething(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title, String initialValue, Consumer<String> callback) {
    Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
    ask.setBounds(new Rectangle(x, y, 100, 60));
    Window askWindow = windowManager.createModalWindow(ask);
    ask.addChild(new Label(mc, gui).setText(title));
    TextField input = new mcjty.lib.gui.widgets.TextField(mc, gui).addTextEnterEvent(((parent, newText) -> {
        windowManager.closeWindow(askWindow);
        callback.accept(newText);
    }));
    input.setText(initialValue);
    ask.addChild(input);
    Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
    buttons.addChild(new Button(mc, gui).setText("Ok").addButtonEvent((parent -> {
        windowManager.closeWindow(askWindow);
        callback.accept(input.getText());
    })));
    buttons.addChild(new Button(mc, gui).setText("Cancel").addButtonEvent((parent -> {
        windowManager.closeWindow(askWindow);
    })));
    ask.addChild(buttons);
}
Also used : Window(mcjty.lib.gui.Window) Window(mcjty.lib.gui.Window) java.awt(java.awt) Consumer(java.util.function.Consumer) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) Button(mcjty.lib.gui.widgets.Button) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) WindowManager(mcjty.lib.gui.WindowManager) Panel(mcjty.lib.gui.widgets.Panel) TextField(mcjty.lib.gui.widgets.TextField) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 72 with Window

use of mcjty.lib.gui.Window in project XNet by McJty.

the class GuiController method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackgrounds(sideBackground, mainBackground).setBackgroundLayout(true, SIDEWIDTH);
    toplevel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, xSize + SIDEWIDTH, ySize));
    initEnergyBar();
    searchBar = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(5, 21, 163, 14));
    searchBar.addTextEvent((parent, newText) -> needsRefresh = true);
    Panel listPanel = initConnectorListPanel();
    Panel channelSelectionPanel = initChannelSelectionPanel();
    initEditPanels();
    toplevel.addChild(channelSelectionPanel).addChild(listPanel).addChild(channelEditPanel).addChild(connectorEditPanel).addChild(searchBar).addChild(energyBar);
    window = new Window(this, toplevel);
    editingConnector = null;
    editingChannel = -1;
    refresh();
    listDirty = 0;
    int currentRF = GenericEnergyStorageTileEntity.getCurrentRF();
    energyBar.setValue(currentRF);
    tileEntity.requestRfFromServer(XNet.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Example 73 with Window

use of mcjty.lib.gui.Window 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, 108)).setLeftMargin(0).setRowheight(-1).addSelectionEvent(new SelectionEvent() {

        @Override
        public void select(Widget widget, int i) {
        }

        @Override
        public void doubleClick(Widget widget, int i) {
            suggestParts();
        }
    });
    slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(239, 25, 9, 108)).setDesiredWidth(11).setVertical().setScrollable(itemList);
    int maxEnergyStored = tileEntity.getMaxEnergyStored(EnumFacing.DOWN);
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(80, 9, 38, 10)).setShowText(false).setHorizontal();
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    extractButton = new Button(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 48, 14)).addButtonEvent(parent -> extractDimlet()).setTooltips("Deconstruct a dimlet into its parts");
    Widget 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) Label(mcjty.lib.gui.widgets.Label) KnownDimletConfiguration(mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration) 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) Map(java.util.Map) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModItems(mcjty.rftoolsdim.items.ModItems) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) EnumFacing(net.minecraft.util.EnumFacing) Settings(mcjty.rftoolsdim.config.Settings) Mouse(org.lwjgl.input.Mouse) Collectors(java.util.stream.Collectors) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) Button(mcjty.lib.gui.widgets.Button) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextField(mcjty.lib.gui.widgets.TextField)

Example 74 with Window

use of mcjty.lib.gui.Window 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(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget 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(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            storeDimlets();
        }
    }).setTooltips("Store dimlets in a", "empty dimension tab");
    nameField = new TextField(mc, this).addTextEvent(new TextEvent() {

        @Override
        public void textChanged(Widget parent, String 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();
    Widget 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) TextEvent(mcjty.lib.gui.events.TextEvent) Label(mcjty.lib.gui.widgets.Label) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) TextField(mcjty.lib.gui.widgets.TextField)

Aggregations

Window (mcjty.lib.gui.Window)74 Panel (mcjty.lib.gui.widgets.Panel)57 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)48 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)29 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)28 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)24 Argument (mcjty.lib.network.Argument)24 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)23 java.awt (java.awt)22 Button (mcjty.lib.gui.widgets.Button)22 RFTools (mcjty.rftools.RFTools)22 TextField (mcjty.lib.gui.widgets.TextField)21 Rectangle (java.awt.Rectangle)20 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)20 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 ResourceLocation (net.minecraft.util.ResourceLocation)17 StyleConfig (mcjty.lib.base.StyleConfig)15 List (java.util.List)12 EmptyContainer (mcjty.lib.container.EmptyContainer)11