Java Code Examples for net.minecraft.client.gui.GuiTextField#setFocused()
The following examples show how to use
net.minecraft.client.gui.GuiTextField#setFocused() .
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: TabUtils.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
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 2
Source File: GuiPortScanner.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
@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 3
Source File: CreateServerButton.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@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 4
Source File: ChangeBackgroundGui.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@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 5
Source File: GuiSolderingStation.java From ExtraCells1 with MIT License | 6 votes |
@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 6
Source File: ButtonInputFieldWrapper.java From SkyblockAddons with MIT License | 5 votes |
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 7
Source File: GuiAdd.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
public void initGui() { Keyboard.enableRepeatEvents(true); buttonList.add(addButton = new GuiButton(1, width / 2 - 100, height / 4 + 72, "Add")); buttonList.add(clipboardButton = new GuiButton(2, width / 2 - 100, height / 4 + 96, "Clipboard")); buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 120, "Back")); username = new GuiTextField(2, Fonts.font40, width / 2 - 100, 60, 200, 20); username.setFocused(true); username.setMaxStringLength(Integer.MAX_VALUE); password = new GuiPasswordField(3, Fonts.font40, width / 2 - 100, 85, 200, 20); password.setMaxStringLength(Integer.MAX_VALUE); }
Example 8
Source File: GuiDirectLogin.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
public void initGui() { Keyboard.enableRepeatEvents(true); buttonList.add(loginButton = new GuiButton(1, width / 2 - 100, height / 4 + 72, "Login")); buttonList.add(clipboardLoginButton = new GuiButton(2, width / 2 - 100, height / 4 + 96, "Clipboard Login")); buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 120, "Back")); username = new GuiTextField(2, Fonts.font40, width / 2 - 100, 60, 200, 20); username.setFocused(true); username.setMaxStringLength(Integer.MAX_VALUE); password = new GuiPasswordField(3, Fonts.font40, width / 2 - 100, 85, 200, 20); password.setMaxStringLength(Integer.MAX_VALUE); }
Example 9
Source File: GuiChangeName.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
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 10
Source File: EditSliderScreen.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@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 11
Source File: GuiQuantumComputer.java From qcraft-mod with Apache License 2.0 | 5 votes |
@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 12
Source File: GuiSpaceLaser.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void initGui() { super.initGui(); int x = (width - xSize) / 2; int y = (height - ySize) / 2; //Create and setup the textboxes xbox = new GuiTextField(0,this.fontRenderer, x + 113, y + 31, 50, 10); ybox = new GuiTextField(1,this.fontRenderer, x + 113, y + 41, 50, 10); xbox.setMaxStringLength(15); xbox.setEnableBackgroundDrawing(true); xbox.setFocused(true); xbox.setCanLoseFocus(true); xbox.setEnabled(true); ybox.setMaxStringLength(15); ybox.setEnableBackgroundDrawing(true); ybox.setFocused(false); ybox.setCanLoseFocus(true); ybox.setEnabled(true); modeDown = new GuiImageButton(0, x + 103, y + 20, 5, 8, zmaster587.libVulpes.inventory.TextureResources.buttonLeft); modeUp = new GuiImageButton(1, x + 157, y + 20, 5, 8, zmaster587.libVulpes.inventory.TextureResources.buttonRight); this.buttonList.add(modeUp); this.buttonList.add(modeDown); this.buttonList.add(new GuiButton(2, x + 103, y + 62, 34,20, "Reset")); }
Example 13
Source File: GuiSearcher.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
/** * 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 14
Source File: GuiEntityTrackOptions.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@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 15
Source File: GuiTerminalFluid.java From ExtraCells1 with MIT License | 4 votes |
@Override public void initGui() { super.initGui(); fluidWidgets = new ArrayList<AbstractFluidWidget>(); Mouse.getDWheel(); List<Fluid> selectorFluids = new ArrayList<Fluid>(); for (SpecialFluidStack stack : oldFluids) { fluidWidgets.add(new WidgetFluidSelector(this, stack)); selectorFluids.add(stack.getFluidStack().getFluid()); } for (Fluid fluid : oldCraftables) if (!selectorFluids.contains(fluid)) fluidWidgets.add(new WidgetFluidRequest(this, fluid)); for (AbstractFluidWidget widget : fluidWidgets) { if (widget instanceof WidgetFluidSelector && widget.getFluid() == oldSelected) { WidgetFluidSelector selector = (WidgetFluidSelector) widget; selector.setSelected(true); updateSelected(selector); } } Collections.sort(fluidWidgets, new FluidWidgetComparator()); searchbar = new GuiTextField(fontRenderer, guiLeft + 81, guiTop - 12, 88, 10) { private int xPos = 0; private int yPos = 0; private int width = 0; private int height = 0; public void mouseClicked(int x, int y, int mouseBtn) { boolean flag = x >= xPos && x < xPos + width && y >= yPos && y < yPos + height; if (flag && mouseBtn == 3) setText(""); } }; searchbar.setEnableBackgroundDrawing(false); searchbar.setFocused(true); searchbar.setMaxStringLength(15); }