@Override public void initGui() { super.initGui(); this.name = new GuiTextField( 0, this.fontRenderer, this.guiLeft + 24, this.guiTop + 32, 79, this.fontRenderer.FONT_HEIGHT ); this.name.setEnableBackgroundDrawing( false ); this.name.setMaxStringLength( 32 ); this.name.setTextColor( 0xFFFFFF ); this.name.setVisible( true ); this.name.setFocused( true ); }
public TextEditElement setMaxLength(int maxLength) { field.setMaxStringLength(maxLength); return this; }
public TextFieldWidget setMaxStringLength(int maxStringLength) { this.maxStringLength = maxStringLength; if(isClientSide()) { this.textField.setMaxStringLength(maxStringLength); } return this; }
@Override public void initGui() { super.initGui(); this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height / 6 + 96, this.yes)); this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height / 6 + 96, this.no)); this.nameField = new GuiTextField(2, this.fontRenderer, this.width / 2 - 155 + 77, this.height / 6 + 70, 155, 12); this.nameField.setTextColor(-1); this.nameField.setDisabledTextColour(-1); this.nameField.setEnableBackgroundDrawing(true); this.nameField.setMaxStringLength(35); this.listLines.clear(); this.listLines.addAll(this.fontRenderer.listFormattedStringToWidth(this.text2, this.width - 50)); this.nameField.setText(sword_names[new Random().nextInt(sword_names.length)]); }
@Override public void initGui() { Keyboard.enableRepeatEvents(true); messageTextField = new GuiDoorMatTextField(2, fontRenderer, this.width / 2 - 150, this.height / 2 - 20, 300, 20, 50, 4); messageTextField.setFocused(true); messageTextField.setMaxStringLength(100); doneBtn = new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done")); cancelBtn = new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel")); buttonList.add(doneBtn); buttonList.add(cancelBtn); doneBtn.enabled = false; }
@Override public void initGui(){ super.initGui(); this.nameField = new GuiTextField(4000, this.fontRenderer, this.guiLeft+5, this.guiTop+6, 114, 8); this.nameField.setMaxStringLength(20); this.nameField.setEnableBackgroundDrawing(false); this.nameField.setFocused(true); }
@Override public void initGui() { super.initGui(); text = new BookTextRenderer(this, getDescriptionText(), LEFT_PAGE_X, TOP_PADDING + 22); visibleEntries = new ArrayList<>(); allEntries = new ArrayList<>(getEntries()); allEntries.removeIf(BookEntry::shouldHide); if(shouldSortEntryList()) Collections.sort(allEntries); searchField = new GuiTextField(0, fontRenderer, 160, 170, 90, 12); searchField.setMaxStringLength(32); searchField.setEnableBackgroundDrawing(false); searchField.setCanLoseFocus(false); searchField.setFocused(true); dependentButtons = new ArrayList<>(); buildEntryButtons(); }
@Override public void initGui() { super.initGui(); text = new BookTextRenderer(this, I18n.format("patchouli.gui.lexicon.editor.info"), LEFT_PAGE_X, TOP_PADDING + 20); textfield = new GuiTextField(0, fontRenderer, 10, FULL_HEIGHT - 40, PAGE_WIDTH, 20); textfield.setMaxStringLength(Integer.MAX_VALUE); textfield.setText(savedText); buttonList.add(new GuiButtonBookResize(this, bookLeft + 115, bookTop + PAGE_HEIGHT - 36, false)); Keyboard.enableRepeatEvents(true); refreshText(); }
@Override public void initGui() { super.initGui(); title += " - " + I18n.translateToLocal("quark.config.import"); int x = width / 2 - 100; int y = height / 6; GuiButton importButton = new GuiButton(1, x, y + 110, 200, 20, I18n.translateToLocal("quark.config.import")); buttonList.add(backButton = new GuiButton(0, x, y + 167, 200, 20, I18n.translateToLocal("gui.done"))); buttonList.add(importButton); buttonList.add(new GuiButton(2, x, y + 132, 200, 20, I18n.translateToLocal("quark.config.opensite"))); textField = new GuiTextField(0, fontRenderer, x, y + 72, 200, 20); textField.setFocused(true); textField.setCanLoseFocus(false); textField.setMaxStringLength(Integer.MAX_VALUE); if(mc.world != null) importButton.enabled = false; }
@SuppressWarnings("unchecked") @Override public void initGui() { itemList = new GuiElementSlotItemlist(this, toolType); this.buttonList.add(new GuiButton(1, this.width / 2 + 2, this.height - 34, 150, 20, I18n.format("gui.veinminer.back"))); this.buttonList.add(new GuiButton(2, this.width / 2 - 152, this.height - 34, 150, 20, I18n.format("gui.veinminer.item.delete"))); addButton = new GuiButton(3, this.width / 2 + 52, 34, 48, 20, I18n.format("gui.veinminer.item.add")); addButton.enabled = false; this.buttonList.add(addButton); clearButton = new GuiButton(4, this.width / 2 + 104, 34, 48, 20, I18n.format("gui.veinminer.item.clear")); clearButton.enabled = false; this.buttonList.add(clearButton); iconRenderer = new IconRenderer(mc, zLevel); textFieldAdd = new GuiTextField(5, this.getFontRenderer(), this.width / 2 - 128, 34, 176, 20); textFieldAdd.setMaxStringLength(128); textFieldAdd.setEnabled(true); textFieldAdd.setFocused(true); }
@Override public void initGui() { super.initGui(); this.searchField = new GuiTextField(0, this.fontRenderer, this.guiLeft + 101, this.guiTop + 6, 80, this.fontRenderer.FONT_HEIGHT); this.searchField.setMaxStringLength(50); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setTextColor(16777215); addButton(new GuiDatabaseButton<>(0, guiLeft - 18, guiTop, DatabaseHelper.ascending, this, DatabaseButton.SORT_DIRECTION_BUTTON)); updateViewedItems(); }
public TextFieldComponent(IValueContainer.Entry entry) { super(entry.getId(), entry.getName()); textFieldLootTable = new GuiTextField(0, Minecraft.getMinecraft().fontRenderer, 0, 0, GuiEditValueContainer.WIDTH - GuiEditValueContainer.PADDING * 2, 20); textFieldLootTable.setMaxStringLength(256); if(entry.getValue() != null) { textFieldLootTable.setText(entry.getValue()); } }
public TextFieldWidget(int xPosition, int yPosition, int width, int height, boolean enableBackground, Supplier<String> textSupplier, Consumer<String> textResponder) { super(); if(isClientSide()) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; this.textField = new GuiTextField(0, fontRenderer, xPosition, yPosition, width, height); this.textField.setCanLoseFocus(true); this.textField.setEnableBackgroundDrawing(enableBackground); this.textField.setMaxStringLength(maxStringLength); this.textField.setGuiResponder(MCGuiUtil.createTextFieldResponder(this::onTextChanged)); } this.textSupplier = textSupplier; this.textResponder = textResponder; }
@Override public void initGui() { super.initGui(); String oldString = searchField != null ? searchField.getText() : ""; this.searchField = new GuiTextField(0, this.fontRenderer, this.guiLeft + selection.getX() + 89 + 36, selection.getY() + this.guiTop + 4, 80, this.fontRenderer.FONT_HEIGHT); this.searchField.setMaxStringLength(50); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setTextColor(16777215); this.searchField.setText(oldString); }
/** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ @Override public void initGui() { this.buttonList.clear(); Keyboard.enableRepeatEvents(true); this.title = I18n.format("createWorld.customize.custom.presets.title"); this.shareText = I18n.format("createWorld.customize.presets.share"); this.listText = I18n.format("createWorld.customize.presets.list"); this.export = new GuiTextField(2, this.fontRenderer, 50, 40, this.width - 100, 20); this.list = new GuiCustomizePresetsMod.ListPreset(); this.export.setMaxStringLength(2000); this.export.setText(this.parent.saveValues()); this.select = this.addButton(new GuiButton(0, this.width / 2 - 102, this.height - 27, 100, 20, I18n.format("createWorld.customize.presets.select"))); this.buttonList.add(new GuiButton(1, this.width / 2 + 3, this.height - 27, 100, 20, I18n.format("gui.cancel"))); this.updateButtonValidity(); }
@Override public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); int i = (width - xSize) / 2; int j = (height - ySize) / 2; textField = new GuiTextField(0, fontRenderer, i + 62, j + 24, 103, 12); textField.setTextColor(-1); textField.setDisabledTextColour(-1); textField.setEnableBackgroundDrawing(false); textField.setMaxStringLength(40); inventorySlots.removeListener(this); inventorySlots.addListener(this); textField.setText(hammer.itemName); canEdit = true; }
@SubscribeEvent public void initGui(GuiScreenEvent.InitGuiEvent.Post event) { GuiScreen gui = event.getGui(); boolean callback = gui instanceof IItemSearchBar; if(callback || gui instanceof GuiChest || gui instanceof GuiShulkerBox) { GuiContainer chest = (GuiContainer) gui; searchBar = new GuiTextField(12831, gui.mc.fontRenderer, chest.getGuiLeft() + 81, chest.getGuiTop() + 6, 88, 10); if(moveToCenterBar) searchBar.y = chest.getGuiTop() + chest.getYSize() - 95; searchBar.setText(text); searchBar.setFocused(false); searchBar.setMaxStringLength(32); searchBar.setEnableBackgroundDrawing(false); if(callback) ((IItemSearchBar) gui).onSearchBarAdded(searchBar); } else searchBar = null; }
@Override public void onGuiInit(int x, int y, int width, int height) { addButton.onGuiInit(); privateButton.onGuiInit(); deleteChannelB.onGuiInit(); sendB.onGuiInit(); recieveB.onGuiInit(); y = parent.getGuiTop() + 12; x = parent.getGuiLeft() + 8; newChannelTF.x = x; newChannelTF.y = y; newChannelTF.setCanLoseFocus(false); newChannelTF.setMaxStringLength(32); newChannelTF.setFocused(true); channelList.onGuiInit(parent); sendChannels.onGuiInit(parent); recieveChannels.onGuiInit(parent); }
@Override public void initGui() { Keyboard.enableRepeatEvents(true); super.initGui(); int width = 127, height = 20; int x = (xSize / 2 - width / 2), y = 26 + (height / 2); txtPassword = new GuiTextField(0, this.fontRenderer, x, y, width, height); txtPassword.setMaxStringLength(40); txtPassword.setText(ctr.tile.getMyPassword()); txtPassword.setFocused(true); x = this.guiLeft - 82; y = this.guiTop; buttonActiveType = new ButtonPassword(PacketType.ACTIVETYPE, x, y); this.addButton(buttonActiveType); y += height + 4; buttonUserClaim = new ButtonPassword(PacketType.USERCLAIM, x, y); this.addButton(buttonUserClaim); y += height + 4; buttonUserPerm = new ButtonPassword(PacketType.USERSALLOWED, x, y); this.addButton(buttonUserPerm); updateVisibility(); }
@Override public void initGui() { super.initGui(); this.searchField = new GuiTextField(0, this.fontRenderer, this.getGuiLeft() + 98, this.getGuiTop() + 6, 70, 10); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setVisible(true); this.searchField.setMaxStringLength(25); this.searchField.setTextColor(0xFFFFFF); IConfigManager cm = ((IConfigurableObject) this.inventorySlots).getConfigManager(); // FIXME: Don't use AE Core classes this.sortByButton = new GuiImgButton(this.getGuiLeft() - 18, this.getGuiTop() + 8, Settings.SORT_BY, cm.getSetting(Settings.SORT_BY)); this.viewItemsButton = new GuiImgButton(this.getGuiLeft() - 18, this.getGuiTop() + 48, Settings.VIEW_MODE, cm.getSetting(Settings.VIEW_MODE)); this.sortDirButton = new GuiImgButton(this.getGuiLeft() - 18, this.getGuiTop() + 28, Settings.SORT_DIRECTION, cm.getSetting(Settings.SORT_DIRECTION)); this.clearButton = new GuiImgButton(this.getGuiLeft() + 87, this.getGuiTop() + 142, Settings.ACTIONS, ActionItems.STASH); this.clearButton.setHalfSize(true); this.addButton(this.sortByButton); this.addButton(this.viewItemsButton); this.addButton(this.sortDirButton); this.addButton(this.clearButton); }