Java Code Examples for net.minecraft.client.gui.GuiTextField#setText()

The following examples show how to use net.minecraft.client.gui.GuiTextField#setText() . 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: 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 2
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 3
Source File: GuiQuantumComputer.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();
    Keyboard.enableRepeatEvents( true );

    int x = ( width - xSize ) / 2;
    int y = ( height - ySize ) / 2;
    m_energizeButton = new GuiButton( BUTTON_ENERGIZE, x + 8, y + 8, xSize - 16, 20, "" );
    m_energizeButton2 = new GuiButton( BUTTON_ENERGIZE, x + 8, y + 8 + 8 + 20 + 6 + 20 + 6, xSize - 16, 20, "" );

    m_localPortalIDField = new GuiTextField( fontRendererObj, x + 9, y - 20, xSize - 18, 20 );
    m_localPortalIDField.setFocused( false );
    m_localPortalIDField.setMaxStringLength( 32 );
    m_localPortalIDField.setText( encodeOptionalText( m_computer.getPortalID() ) );

    m_destinationPortalIDField = new GuiTextField( fontRendererObj, x + 9, y + 8 + 8,  xSize - 18, 20 );
    m_destinationPortalIDField.setFocused( false );
    m_destinationPortalIDField.setMaxStringLength( 32 );
    m_destinationPortalIDField.setText( encodeOptionalText( m_computer.getRemotePortalID() ) );

    m_changeServerButton = new GuiButton( BUTTON_CYCLE_SERVERS, x + 8, y + 8 + 8 + 20 + 6, xSize - 16 - 16 - 3 - 16 - 3, 20, "" );
    m_addServerButton = new GuiButton( BUTTON_ADD_SERVER, x + xSize - 8 - 16 - 3 - 16, y + 8 + 8 + 20 + 6, 16, 20, "+" );
    m_removeServerButton =  new GuiButton( BUTTON_REMOVE_SERVER, x + xSize - 8 - 16, y + 8 + 8 + 20 + 6, 16, 20, "-" );
    m_confirmAddServerButton = new GuiButton( BUTTON_CONFIRM_ADD_SERVER, x + xSize - 8 - 35, y + 8 + 8 + 20 + 6, 35, 20, I18n.format( "gui.qcraft:computer.ok" ) );

    m_newServerAddressField = new GuiTextField( fontRendererObj, x + 9, y + 8 + 8 + 20 + 7, xSize - 18 - 35 - 3, 18 );
    m_newServerAddressField.setFocused( false );
    m_newServerAddressField.setMaxStringLength( 64 );
    m_newServerAddressField.setText( encodeOptionalText( m_computer.getRemoteServerAddress() ) );

    updateStatus();
}
 
Example 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
Source File: ButtonInputFieldWrapper.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public ButtonInputFieldWrapper(int x, int y, int w, int h, String buttonText, String placeholderText, int maxLength, boolean focused, UpdateCallback<String> textUpdated) {
    super(-1, x, y, buttonText);
    this.placeholderText = placeholderText;
    this.textUpdated = textUpdated;

    textField = new GuiTextField(-1, Minecraft.getMinecraft().fontRendererObj, x, y, w, h);
    textField.setMaxStringLength(maxLength);
    textField.setFocused(focused);
    textField.setText(buttonText);
}
 
Example 12
Source File: GuiCyberwareMenu.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public void initGui()
{
	super.initGui();
	int numRows = ((colorOptions.length + ROW_SIZE - 1) / ROW_SIZE);
	hex = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 70, this.height / 2 - 100 + (30 * numRows), 140, 20);
	String s = Integer.toHexString(CyberwareAPI.getHUDColorHex()).toUpperCase();
	while (s.length() < 6)
	{
		s = "0" + s;
	}
	hex.setText(s);
	hex.setEnabled(false);
}
 
Example 13
Source File: EditSliderScreen.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui()
{
	valueField = new GuiTextField(1, WMinecraft.getFontRenderer(),
		width / 2 - 100, 60, 200, 20);
	valueField
		.setText(ValueDisplay.DECIMAL.getValueString(slider.getValue()));
	valueField.setSelectionPos(0);
	valueField.setFocused(true);
	
	buttonList.add(doneButton =
		new GuiButton(0, width / 2 - 100, height / 3 * 2, "Done"));
}
 
Example 14
Source File: GuiModIdConfig.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() {
    modId = new GuiTextField(this.fontRendererObj, this.width / 2 - 99, this.height / 6 + 66, 198, 18);
    modId.setText(Main.modId);
    modVersion = new GuiTextField(this.fontRendererObj, this.width / 2 - 99, this.height / 6 + 66 + 36, 198, 18);
    modVersion.setText(Main.modVersion);
    saveButton = new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, "Save");
    this.buttonList.add(saveButton);
}
 
Example 15
Source File: GuiChangeName.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public void initGui() {
    Keyboard.enableRepeatEvents(true);
    buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 96, "Change"));
    buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 120, "Back"));

    name = new GuiTextField(2, Fonts.font40, width / 2 - 100, 60, 200, 20);
    name.setFocused(true);
    name.setText(mc.getSession().getUsername());
    name.setMaxStringLength(16);
}
 
Example 16
Source File: NameHistoryGui.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void initGui() {
    super.initGui();
    nameField = new GuiTextField(1, mc.fontRendererObj, width / 2 - (115 / 2), height / 5 + 10, 115, 20);
    nameField.setText(name);
}
 
Example 17
Source File: GuiReactorControlRod.java    From BigReactors with MIT License 4 votes vote down vote up
@Override
public void initGui() {
	super.initGui();

	int leftX = guiLeft + 4;
	int topY = guiTop + 4;
	
	Keyboard.enableRepeatEvents(true);
	
	titleString = new BeefGuiLabel(this, "Reactor Control Rod", leftX, topY);
	topY += titleString.getHeight() + 8;
	
	rodNameLabel = new BeefGuiLabel(this, "Name:", leftX, topY + 6);
	
	rodName = new GuiTextField(fontRendererObj, leftX + 4 + rodNameLabel.getWidth(), topY, 100, 20);
	rodName.setCanLoseFocus(true);
	rodName.setMaxStringLength(32);
	rodName.setText(entity.getName());
	rodName.setEnabled(true);
	
	setNameBtn = new GuiButton(2, guiLeft + 140, topY, 30, 20, "Set");
	setNameBtn.enabled = false;
	topY += 28;
	
	rodInsertIcon = new BeefGuiIcon(this, leftX+42, topY, 16, 16, ClientProxy.GuiIcons.getIcon("controlRod"), new String[] { EnumChatFormatting.AQUA + "Rod Insertion", "", "Change the control rod's insertion.", "Higher insertion slows reaction rate.", "", "Lower reaction rates reduce heat,", "energy, radiation output, and", "fuel consumption." });
	insertionLabel = new BeefGuiLabel(this, "", leftX+62, topY+5);
	topY += 20;
	insertionBar = new BeefGuiInsertionProgressBar(this, leftX+40, topY);

	topY += 12;
	rodRetractBtn = new GuiIconButton(0, leftX+70, topY, 20, 20, ClientProxy.GuiIcons.getIcon("upArrow"), new String[] { EnumChatFormatting.AQUA + "Insert Rod", "Increase insertion by 10.", "", "Shift: +100", "Alt: +5", "Shift+Alt: +1", "", "Ctrl: Change ALL Rods" });
	topY += 20;
	rodInsertBtn = new GuiIconButton(1, leftX+70, topY, 20, 20, ClientProxy.GuiIcons.getIcon("downArrow"), new String[] { EnumChatFormatting.AQUA + "Retract Rod", "Reduce insertion by 10.", "", "Shift: -100", "Alt: -5", "Shift+Alt: -1", "", "Ctrl: Change ALL Rods" });
	topY += 32;

	registerControl(insertionBar);
	registerControl(titleString);
	registerControl(rodNameLabel);
	registerControl(rodInsertIcon);
	registerControl(insertionLabel);

	registerControl(rodName);
	registerControl(rodRetractBtn);
	registerControl(rodInsertBtn);
	registerControl(setNameBtn);
	
	updateStrings();
}