net.minecraft.client.gui.GuiTextField Java Examples

The following examples show how to use net.minecraft.client.gui.GuiTextField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MwGuiTextDialog.java    From mapwriter with MIT License 7 votes vote down vote up
private void newTextField() {
if (this.textField != null) {
	this.text = this.textField.getText();
}
  	int w = this.width * textDialogWidthPercent / 100;
  	this.textField = new GuiTextField(this.fontRendererObj,
  			(this.width - w) / 2 + 5,
  			textDialogY,
  			w - 10,
  			12);
this.textField.setMaxStringLength(32);
this.textField.setFocused(true);
this.textField.setCanLoseFocus(false);
//this.textField.setEnableBackgroundDrawing(false);
      this.textField.setText(this.text);
  }
 
Example #2
Source File: GuiSolderingStation.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
	int posX = (this.width - xSize) / 2;
	int posY = (this.height - ySize) / 2;

	if (rightItem)
	{
		this.buttonList.clear();
		this.buttonList.add(new GuiButton(0, posX + 5, posY + 17, 40, 20, "- 2048"));
		this.buttonList.add(new GuiButton(1, posX + 130, posY + 17, 40, 20, "+ 2048"));
		this.buttonList.add(new GuiButton(2, posX + 5, posY + 47, 40, 20, "- 1"));
		this.buttonList.add(new GuiButton(3, posX + 130, posY + 47, 40, 20, "+ 1"));

		textfield_size = new GuiTextField(fontRenderer, posX + 40, posY + 20, 90, 15);
		textfield_size.setFocused(false);
		textfield_size.setMaxStringLength(12);

		textfield_types = new GuiTextField(fontRenderer, posX + 40, posY + 50, 90, 15);
		textfield_types.setFocused(false);
		textfield_types.setMaxStringLength(2);
	}
}
 
Example #3
Source File: ChangeBackgroundGui.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui() {
    downloadUrlField = new GuiTextField(0, mc.fontRendererObj, width / 4, height / 2 - 10, width / 2, 20);
    downloadUrlField.setFocused(true);
    downloadUrlField.setMaxStringLength(150);
    buttonList.add(new GuiButton(1, width / 2 - 150 / 2, height / 2 + 20, 150, 20,
        I18n.format("button.changebackground.seturl")));
    buttonList.add(new GuiButton(2, width / 2 - 150 / 2, height / 2 + 42, 150, 20,
        I18n.format("button.changebackground.choosefile")));
    buttonList.add(new GuiButton(3, width / 2 - 150 / 2, height / 2 + 64, 150, 20,
        I18n.format("button.changebackground.resetbackground")));
    buttonList.add(new GuiButton(4, width / 2 - 150 / 2, height / 2 + 86, 150, 20,
        I18n.format("gui.cancel")));

    if (Minecraft.getMinecraft().isFullScreen()) Minecraft.getMinecraft().toggleFullscreen();
}
 
Example #4
Source File: CreateServerButton.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui() {
    serverName = new GuiTextField(0, fontRendererObj, width / 2 - 100, height / 2 - 28, 200, 20);
    serverName.setFocused(true);
    serverName.setMaxStringLength(32);
    serverName.setText(Settings.SERVER_BUTTON_NAME);

    serverIp = new GuiTextField(1, fontRendererObj, width / 2 - 100, height / 2 - 4, 200, 20);
    serverIp.setFocused(false);
    serverIp.setMaxStringLength(72);
    serverIp.setText(Settings.SERVER_IP);

    if (serverName.isFocused()) {
        currentlyFocusedField = serverName;
    } else if (serverIp.isFocused()) {
        currentlyFocusedField = serverIp;
    }

    buttonList.add(new GuiButton(2, width / 2 - 100, height / 2 + 20, I18n.format("gui.done")));
}
 
Example #5
Source File: GuiScreenBase.java    From LunatriusCore with MIT License 6 votes vote down vote up
@Override
protected void keyTyped(final char character, final int code) throws IOException {
    if (code == Keyboard.KEY_ESCAPE) {
        this.mc.displayGuiScreen(this.parentScreen);
        return;
    }

    for (final GuiButton button : this.buttonList) {
        if (button instanceof GuiNumericField) {
            final GuiNumericField numericField = (GuiNumericField) button;
            numericField.keyTyped(character, code);

            if (numericField.isFocused()) {
                actionPerformed(numericField);
            }
        }
    }

    for (final GuiTextField textField : this.textFields) {
        textField.textboxKeyTyped(character, code);
    }

    super.keyTyped(character, code);
}
 
Example #6
Source File: GuiPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();

    Keyboard.enableRepeatEvents(true);

    this.nameField = new GuiTextField(0, this.fontRenderer, 11, 131, 154, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(50);
    this.nameField.setEnabled(true);
    this.nameField.setText(this.tepp.getPanelDisplayName());
    this.nameField.setFocused(false);
    this.nameField.setCursorPositionEnd();

    this.createButtons();

}
 
Example #7
Source File: EditBlockListScreen.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
	listGui = new ListGui(mc, this, blockList.getBlockNames());
	
	blockNameField = new GuiTextField(1, WMinecraft.getFontRenderer(), 64,
		height - 55, 150, 18);
	
	buttonList
		.add(addButton = new GuiButton(0, 214, height - 56, 30, 20, "Add"));
	buttonList.add(removeButton = new GuiButton(1, width - 150, height - 56,
		100, 20, "Remove Selected"));
	buttonList.add(
		new GuiButton(2, width - 108, 8, 100, 20, "Reset to Defaults"));
	buttonList.add(doneButton =
		new GuiButton(3, width / 2 - 100, height - 28, "Done"));
}
 
Example #8
Source File: GuiScreenBuilderWandTemplate.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();

    Keyboard.enableRepeatEvents(true);

    this.guiLeft = (this.width - this.xSize) / 2;
    this.guiTop = (this.height - this.ySize) / 2;

    this.nameField = new GuiTextField(0, this.fontRenderer, this.guiLeft + 10, this.guiTop + 25, 173, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(60);
    this.nameField.setEnabled(true);
    this.nameField.setText(this.getTemplateNameFromItem());
    this.nameField.setFocused(true);
    this.nameField.setCursorPositionEnd();

    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, this.guiLeft + 8, this.guiTop + 40, 80, 20, I18n.format("enderutilities.gui.label.setname")));
}
 
Example #9
Source File: BeefGuiBase.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float gameTicks, int mouseX, int mouseY) {
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.renderEngine.bindTexture(getGuiBackground());
	this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
	
	int relativeX, relativeY;
	relativeX = mouseX - this.guiLeft;
	relativeY = mouseY - this.guiTop;
	for(IBeefGuiControl c : controls) {
		c.drawBackground(this.mc.renderEngine, relativeX, relativeY);
	}
	
	for(GuiTextField field : textFields) {
		field.drawTextBox();
	}
}
 
Example #10
Source File: GuiToolWorkstation.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();

    Keyboard.enableRepeatEvents(true);

    this.nameField = new GuiTextField(0, this.fontRenderer, 34, 100, 134, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(50);
    this.nameField.setEnabled(true);
    this.nameField.setText(this.te.getItemName());
    this.nameField.setFocused(false);
    this.nameField.setCursorPositionEnd();

    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, this.guiLeft + 108, this.guiTop + 113, 60, 20, I18n.format("enderutilities.gui.label.setname")));
}
 
Example #11
Source File: GuiPortScanner.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui() {
    Keyboard.enableRepeatEvents(true);

    hostField = new GuiTextField(0, Fonts.font40, width / 2 - 100, 60, 200, 20);
    hostField.setFocused(true);
    hostField.setMaxStringLength(Integer.MAX_VALUE);
    hostField.setText("localhost");

    minPortField = new GuiTextField(1, Fonts.font40, width / 2 - 100, 90, 90, 20);
    minPortField.setMaxStringLength(5);
    minPortField.setText(String.valueOf(1));

    maxPortField = new GuiTextField(2, Fonts.font40, width / 2 + 10, 90, 90, 20);
    maxPortField.setMaxStringLength(5);
    maxPortField.setText(String.valueOf(65535));

    threadsField = new GuiTextField(3, Fonts.font40, width / 2 - 100, 120, 200, 20);
    threadsField.setMaxStringLength(Integer.MAX_VALUE);
    threadsField.setText(String.valueOf(500));

    buttonList.add(buttonToggle = new GuiButton(1, width / 2 - 100, height / 4 + 95, running ? "Stop" : "Start"));
    buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 120, "Back"));
    buttonList.add(new GuiButton(2, width / 2 - 100, height / 4 + 155, "Export"));
    super.initGui();
}
 
Example #12
Source File: TabUtils.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
public static void tab(final GuiTextField... textFields) {
    for(int i = 0; i < textFields.length; i++) {
        final GuiTextField textField = textFields[i];

        if(textField.isFocused()) {
            textField.setFocused(false);
            i++;

            if(i >= textFields.length)
                i = 0;

            textFields[i].setFocused(true);
            break;
        }
    }
}
 
Example #13
Source File: GuiSoundBlock.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initSearchField(String str)
{
    Keyboard.enableRepeatEvents(true);

    this.searchField = new GuiTextField(0, this.fontRenderer, 8, 26, 141, 12);
    this.searchField.setTextColor(-1);
    this.searchField.setDisabledTextColour(-1);
    this.searchField.setEnableBackgroundDrawing(false);
    this.searchField.setMaxStringLength(50);
    this.searchField.setEnabled(true);
    this.searchField.setText(str);
    this.searchField.setFocused(false);
}
 
Example #14
Source File: MixinGuiEditSign.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "initGui", at = @At("RETURN"))
private void initGui(final CallbackInfo callbackInfo) {
    buttonList.add(toggleButton = new GuiButton(1, this.width / 2 - 100, this.height / 4 + 145, enabled ? "Disable Formatting codes" : "Enable Formatting codes"));

    this.signCommand1 = new GuiTextField(0, fontRendererObj, this.width / 2 - 100, height - 15, 200, 10);
    this.signCommand2 = new GuiTextField(1, fontRendererObj, this.width / 2 - 100, height - 15 * 2, 200, 10);
    this.signCommand3 = new GuiTextField(2, fontRendererObj, this.width / 2 - 100, height - 15 * 3, 200, 10);
    this.signCommand4 = new GuiTextField(3, fontRendererObj, this.width / 2 - 100, height - 15 * 4, 200, 10);

    this.signCommand1.setText("");
    this.signCommand2.setText("");
    this.signCommand3.setText("");
    this.signCommand4.setText("");
}
 
Example #15
Source File: GuiHelm.java    From archimedes-ships with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
	super.initGui();
	
	Keyboard.enableRepeatEvents(true);
	
	int btnx = guiLeft - 100;
	int btny = guiTop + 20;
	buttonList.clear();
	
	btnRename = new GuiButton(4, btnx, btny, 100, 20, StatCollector.translateToLocal("gui.shipstatus.rename"));
	buttonList.add(btnRename);
	
	btnAssemble = new GuiButton(1, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.compile"));
	buttonList.add(btnAssemble);
	
	btnUndo = new GuiButton(2, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.undo"));
	btnUndo.enabled = tileEntity.getPrevAssembleResult() != null && tileEntity.getPrevAssembleResult().getCode() != AssembleResult.RESULT_NONE;
	buttonList.add(btnUndo);
	
	btnMount = new GuiButton(3, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.mount"));
	btnMount.enabled = tileEntity.getAssembleResult() != null && tileEntity.getAssembleResult().getCode() == AssembleResult.RESULT_OK;
	buttonList.add(btnMount);
	
	txtShipName = new GuiTextField(fontRendererObj, guiLeft + 8 + xSize / 2, guiTop + 21, 120, 10);
	txtShipName.setMaxStringLength(127);
	txtShipName.setEnableBackgroundDrawing(false);
	txtShipName.setVisible(true);
	txtShipName.setCanLoseFocus(false);
	txtShipName.setTextColor(0xFFFFFF);
	txtShipName.setText(tileEntity.getShipInfo().shipName);
}
 
Example #16
Source File: GuiScreenBase.java    From LunatriusCore with MIT License 5 votes vote down vote up
@Override
protected void mouseClicked(final int mouseX, final int mouseY, final int mouseEvent) throws IOException {
    for (final GuiButton button : this.buttonList) {
        if (button instanceof GuiNumericField) {
            final GuiNumericField numericField = (GuiNumericField) button;
            numericField.mouseClicked(mouseX, mouseY, mouseEvent);
        }
    }

    for (final GuiTextField textField : this.textFields) {
        textField.mouseClicked(mouseX, mouseY, mouseEvent);
    }

    super.mouseClicked(mouseX, mouseY, mouseEvent);
}
 
Example #17
Source File: GuiScreenBase.java    From LunatriusCore with MIT License 5 votes vote down vote up
@Override
public void updateScreen() {
    super.updateScreen();

    for (final GuiButton button : this.buttonList) {
        if (button instanceof GuiNumericField) {
            final GuiNumericField numericField = (GuiNumericField) button;
            numericField.updateCursorCounter();
        }
    }

    for (final GuiTextField textField : this.textFields) {
        textField.updateCursorCounter();
    }
}
 
Example #18
Source File: GuiCamoMine.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(){
    super.initGui();
    resetButton = new GuiButton(0, guiLeft + 10, guiTop + 37, 40, 20, "");
    buttonList.add(resetButton);

    textField = new GuiTextField(fontRendererObj, guiLeft + 100, guiTop + 65, 70, 12);
    textField.setMaxStringLength(40);
    textField.setText(te.getTarget());
}
 
Example #19
Source File: GuiScreenBase.java    From LunatriusCore with MIT License 5 votes vote down vote up
@Override
public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);

    for (final GuiTextField textField : this.textFields) {
        textField.drawTextBox();
    }
}
 
Example #20
Source File: GuiNumericField.java    From LunatriusCore with MIT License 5 votes vote down vote up
public GuiNumericField(final FontRenderer fontRenderer, final int id, final int x, final int y, final int width, final int height) {
    super(id, 0, 0, width, height, "");
    this.guiTextField = new GuiTextField(0, fontRenderer, x + 1, y + 1, width - BUTTON_WIDTH * 2 - 2, height - 2);
    this.guiButtonDec = new GuiButton(1, x + width - BUTTON_WIDTH * 2, y, BUTTON_WIDTH, height, "-");
    this.guiButtonInc = new GuiButton(2, x + width - BUTTON_WIDTH * 1, y, BUTTON_WIDTH, height, "+");

    setValue(DEFAULT_VALUE);
}
 
Example #21
Source File: GuiAirGrateModule.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(){
    super.initGui();
    addLabel(I18n.format("gui.entityFilter"), guiLeft + 10, guiTop + 14);

    textfield = new GuiTextField(fontRendererObj, guiLeft + 10, guiTop + 25, 160, 10);
    textfield.setText(((ModuleAirGrate)module).entityFilter);
}
 
Example #22
Source File: GuiPressureModule.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(){
    super.initGui();
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    addLabel("lower", guiLeft + 10, guiTop + 30);
    addLabel("bar", guiLeft + 45, guiTop + 42);
    addLabel("higher", guiLeft + 140, guiTop + 30);

    String title = I18n.format("item." + module.getType() + ".name");
    addLabel(title, width / 2 - fontRendererObj.getStringWidth(title) / 2, guiTop + 5);

    lowerBoundField = new GuiTextField(fontRendererObj, xStart + 10, yStart + 41, 30, 10);
    lowerBoundField.setText(PneumaticCraftUtils.roundNumberTo(module.lowerBound, 1));
    higherBoundField = new GuiTextField(fontRendererObj, xStart + 140, yStart + 41, 30, 10);
    higherBoundField.setText(PneumaticCraftUtils.roundNumberTo(module.higherBound, 1));

    graphLowY = guiTop + 153;
    graphHighY = guiTop + 93;
    graphLeft = guiLeft + 22;
    graphRight = guiLeft + 172;
    addWidget(new WidgetTooltipArea(graphLeft - 20, graphHighY, 25, graphLowY - graphHighY, "gui.redstone"));
    addWidget(new WidgetTooltipArea(graphLeft, graphLowY - 5, graphRight - graphLeft, 25, "gui.threshold"));
    addWidget((IGuiWidget)new GuiAnimatedStat(this, "gui.tab.info", Textures.GUI_INFO_LOCATION, xStart, yStart + 5, 0xFF8888FF, null, true).setText("gui.tab.info.tubeModule"));
    advancedMode = new GuiCheckBox(0, guiLeft + 6, guiTop + 15, 0xFF000000, "gui.tubeModule.advancedConfig").setTooltip(I18n.format("gui.tubeModule.advancedConfig.tooltip"));
    advancedMode.checked = true;
    addWidget(advancedMode);
}
 
Example #23
Source File: GuiPressureChamberInterface.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(){
    super.initGui();

    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    statusStat = addAnimatedStat("Interface Status", new ItemStack(Blockss.pressureChamberInterface), 0xFFFFAA00, false);
    filterStat = addAnimatedStat("Filter", new ItemStack(net.minecraft.init.Blocks.hopper), 0xFF005500, false);
    filterStat.setTextWithoutCuttingString(getFilterText());

    Rectangle buttonRect = filterStat.getButtonScaledRectangle(5, 30, 170, 20);
    filterButton = new GuiButtonSpecial(1, buttonRect.x, buttonRect.y, buttonRect.width, buttonRect.height, "-");
    filterStat.addWidget(filterButton);

    creativeTabButton = new GuiButton(2, xStart + 91, yStart + 58, 78, 20, "-");
    nameFilterField = new GuiTextField(fontRendererObj, xStart + 91, yStart + 58, 78, 10);
    nameFilterField.setText(te.itemNameFilter);

    buttonList.add(creativeTabButton);
    if(te.filterMode != TileEntityPressureChamberInterface.EnumFilterMode.ITEM) {
        if(((Slot)inventorySlots.inventorySlots.get(5)).xDisplayPosition < 1000) {
            for(int i = 5; i < 14; i++) {
                ((Slot)inventorySlots.inventorySlots.get(i)).xDisplayPosition += 1000;
            }
        }
    } else {
        if(((Slot)inventorySlots.inventorySlots.get(5)).xDisplayPosition > 1000) {
            for(int i = 5; i < 14; i++) {
                ((Slot)inventorySlots.inventorySlots.get(i)).xDisplayPosition -= 1000;
            }
        }
    }
}
 
Example #24
Source File: GuiUniversalSensor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(){
    super.initGui();

    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    sensorInfoStat = addAnimatedStat("Sensor Info", new ItemStack(Blockss.universalSensor), 0xFFFFAA00, false);
    addAnimatedStat("gui.tab.upgrades", Textures.GUI_UPGRADES_LOCATION, 0xFF0000FF, true).setText(getUpgradeText());

    nameFilterField = new GuiTextField(fontRendererObj, xStart + 70, yStart + 58, 100, 10);
    nameFilterField.setText(te.getText(0));

    updateButtons();//also adds the redstoneButton.
}
 
Example #25
Source File: GuiSearcher.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question.
 */
@Override
public void initGui(){
    super.initGui();
    buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    searchField = new GuiTextField(fontRendererObj, guiLeft + 20, guiTop + 36, 89, fontRendererObj.FONT_HEIGHT);
    searchField.setMaxStringLength(15);
    searchField.setEnableBackgroundDrawing(true);
    searchField.setVisible(true);
    searchField.setFocused(true);
    searchField.setTextColor(16777215);

    updateCreativeSearch();
}
 
Example #26
Source File: GuiEntityTrackOptions.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui(IGuiScreen gui){
    gui.getButtonList().add(new GuiButton(10, 30, 128, 150, 20, "Move Stat Screen..."));
    textField = new GuiTextField(gui.getFontRenderer(), 35, 60, 140, 10);
    textField.setFocused(true);
    if(PneumaticCraft.proxy.getPlayer() != null) textField.setText(ItemPneumaticArmor.getEntityFilter(PneumaticCraft.proxy.getPlayer().getCurrentArmor(3)));
}
 
Example #27
Source File: BeefGuiBase.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void initGui() {
	super.initGui();

	// Refresh all controls so that the GUI is resize-proof
	controls = new ArrayList<IBeefGuiControl>();
	controlsWithTooltips = new ArrayList<IBeefTooltipControl>();
	textFields = new ArrayList<GuiTextField>();
}
 
Example #28
Source File: BeefGuiBase.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
protected void mouseClicked(int x, int y, int buttonIndex) {
	super.mouseClicked(x, y, buttonIndex);
	for(GuiTextField field : textFields) {
		field.mouseClicked(x, y, buttonIndex);
	}
	
	for(IBeefGuiControl c: controls) {
		c.onMouseClicked(x, y, buttonIndex);
	}
}
 
Example #29
Source File: XrayModMainGui.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initGui() {
	Keyboard.enableRepeatEvents(true);

	this.buttonList.clear();
	if (chooseScreen == 0) { //default
		this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 +   0 + 12,"Select blocks to see in X-ray view"));
		this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 +  25 + 12,"Switch to the profile in the textbox"));
		this.buttonList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 +  75 + 12,"Go to MCF topic for support/updates"));
		this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 100 + 12,"Change settings"));
		this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 125 + 12,"Return to the game"));
		this.profileNameTextBox = new GuiTextField(0, this.fontRenderer, this.width / 2 - 100, this.height / 4 + 50 + 12, 200, 20);
		this.profileNameTextBox.setMaxStringLength(32);
		this.profileNameTextBox.setFocused(true);
		UyjuliansXrayModMain.getModInstance();
		this.profileNameTextBox.setText(UyjuliansXrayModMain.currentBlocklistName);
		this.buttonList.get(2).enabled = ((this.profileNameTextBox.getText().length() > 0));
	}
	else if (chooseScreen == 1) { //option chooser
		this.configKeyTextBox = new GuiTextField(0, this.fontRenderer, this.width / 2 - 100, this.height / 4 + 0 + 12, 200, 20);
		this.configValueTextBox = new GuiTextField(0, this.fontRenderer, this.width / 2 - 100, this.height / 4 + 25 + 12, 200, 20);
		this.configKeyTextBox.setMaxStringLength(32);
		this.configValueTextBox.setMaxStringLength(32);
		this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 50 + 12, "Set option"));
	}
}
 
Example #30
Source File: ConsoleInputGui.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question.
 */
@Override
public void initGui() {
    Keyboard.enableRepeatEvents(true);
    this.sentHistoryCursor = EHacksGui.clickGui.consoleGui.getSentMessages().size();
    this.inputField = new GuiTextField(this.fontRendererObj, 4, this.height - 12, this.width - 4, 12);
    this.inputField.setMaxStringLength(100);
    this.inputField.setEnableBackgroundDrawing(false);
    this.inputField.setFocused(true);
    this.inputField.setText(this.defaultInputFieldText);
    this.inputField.setCanLoseFocus(false);
}