@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 ); }
@Override public void onInitGui() { super.onInitGui(); if(!GuiLexicon.isValidLexiconGui(this)) { currentOpenLexicon = new GuiLexicon(); mc.displayGuiScreen(currentOpenLexicon); ClientTickHandler.notifyPageChange(); return; } buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2)); buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false)); buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true)); searchField = new GuiTextField(15, fontRenderer, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10); searchField.setCanLoseFocus(false); searchField.setFocused(true); searchField.setEnableBackgroundDrawing(false); updateAll(); }
@Override public void initGui() { super.initGui(); textFields.clear(); int fieldWidth = 40; int fieldHeight = 20; GuiTextField top = new GuiTextField(0, fontRenderer, (width - fieldWidth) / 2 - 57, (height - fieldHeight) / 2 - 77, fieldWidth, fieldHeight); GuiTextField mid = new GuiTextField(0, fontRenderer, (width - fieldWidth) / 2 - 57, (height - fieldHeight) / 2 - 49, fieldWidth, fieldHeight); top.setEnableBackgroundDrawing(false); mid.setEnableBackgroundDrawing(false); textFields.add(top); textFields.add(mid); updateTextFields(); // buttonList.add(new GuiButton(1, width/2-100, height/2-24, "Bastard button")); }
@Override public void initGui() { super.initGui(); this.mc.player.openContainer = this.inventorySlots; this.guiLeft = (this.width - this.xSize) / 2; this.guiTop = (this.height - this.ySize) / 2; textFields.clear(); int fieldWidth = 40; int fieldHeight = 20; GuiTextField top = new GuiTextField(0, fontRenderer, (width - fieldWidth) / 2 - 61, (height - fieldHeight) / 2 - 77, fieldWidth, fieldHeight); GuiTextField mid = new GuiTextField(0, fontRenderer, (width - fieldWidth) / 2 - 57, (height - fieldHeight) / 2 - 49, fieldWidth, fieldHeight); GuiTextField bot = new GuiTextField(0, fontRenderer, (width - fieldWidth) / 2 - 57, (height - fieldHeight) / 2 - 20, fieldWidth, fieldHeight); top.setEnableBackgroundDrawing(false); mid.setEnableBackgroundDrawing(false); bot.setEnableBackgroundDrawing(false); textFields.add(top); textFields.add(mid); textFields.add(bot); updateTextFields(); // buttonList.add(new GuiButton(1, width/2-100, height/2-24, "Bastard button")); }
@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() { super.initGui(); left = (this.width - this.xSize) / 2; top = (this.height - this.ySize) / 2; this.buttonList.clear(); this.buttonList.add(new GuiButton(0, left + 176, top + 14, 18, 18, "D")); this.buttonList.add(new GuiButton(1, left + 176, top + 32, 18, 18, "U")); this.buttonList.add(new GuiButton(2, left + 176, top + 50, 18, 18, "N")); this.buttonList.add(new GuiButton(3, left + 176, top + 68, 18, 18, "S")); this.buttonList.add(new GuiButton(4, left + 176, top + 86, 18, 18, "W")); this.buttonList.add(new GuiButton(5, left + 176, top + 104, 18, 18, "E")); this.buttonList.add(new GuiButton(6, left + 160, top + 50, 10, 18, ">")); this.buttonList.add(new GuiButton(7, left + 132, top + 50, 10, 18, "<")); disableDirectionalButton(inventory.currentActiveSlot); this.textBox = new GuiTextField(0, this.fontRenderer, left + 94, top + 37, 70, 12); this.textBox.setEnableBackgroundDrawing(false); this.textBox.setText(""); }
@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(); this.buttonList.add(new GuiButton(1, this.guiLeft + this.xSize / 2 - 44, this.guiTop + 35, 88, 20, I18n.translateToLocal("extracells.tooltip.save"))); this.searchbar = new GuiTextField(0, this.fontRenderer, this.guiLeft + this.xSize / 2 - 75, this.guiTop + 20, 150, 10) { private int xPos = 0; private int yPos = 0; private int width = 0; private int height = 0; @Override public boolean mouseClicked(int x, int y, int mouseBtn) { boolean flag = x >= this.xPos && x < this.xPos + this.width && y >= this.yPos && y < this.yPos + this.height; if (flag && mouseBtn == 3) { setText(""); } return flag; } }; this.searchbar.setEnableBackgroundDrawing(true); this.searchbar.setFocused(true); this.searchbar.setMaxStringLength(128); this.searchbar.setText(filter); }
@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 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); }
@Override public void init(int x, int y) { addSideButton(new SideButtonRedstoneMode(this, readerWriter.getRedstoneModeParameter())); add = addButton(x + 128, y + 15, 20, 20, "+"); remove = addButton(x + 150, y + 15, 20, 20, "-"); name = new GuiTextField(0, fontRenderer, x + 8 + 1, y + 20 + 1, 107, fontRenderer.FONT_HEIGHT); name.setEnableBackgroundDrawing(false); name.setVisible(true); name.setTextColor(16777215); name.setCanLoseFocus(true); name.setFocused(false); }
@Override public void init(int x, int y) { addSideButton(new SideButtonType(this, TileDetector.TYPE)); addSideButton(new SideButtonDetectorMode(this)); addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_NBT)); amount = new GuiTextField(0, fontRenderer, x + 41 + 1, y + 23 + 1, 50, fontRenderer.FONT_HEIGHT); amount.setText(String.valueOf(TileDetector.AMOUNT.getValue())); amount.setEnableBackgroundDrawing(false); amount.setVisible(true); amount.setTextColor(16777215); amount.setCanLoseFocus(true); amount.setFocused(false); }
@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; }
public TextEditElement(int xPos, int yPos, int width, int height) { super(xPos, yPos, width, height); field = new GuiTextField(0, Minecraft.getMinecraft().fontRenderer, 0, 0, width, height); field.setEnableBackgroundDrawing(false); this.addSelfEventHandler(GuiEvent.KeyEvent.class, event -> { String oldText = field.getText(); this.field.textboxKeyTyped(event.getCharacter(), event.getKey()); final String text = field.getText(); if (!text.equals(oldText)) { postEvent(new TextEditEvent(this, text, oldText), GuiEventDestination.ALL); } }); this.addSelfEventHandler(GuiEvent.DownEvent.class, event -> { IWindowElement windowElement = getWindow(); this.field.mouseClicked(windowElement.getRelativeMouseX(this), windowElement.getRelativeMouseY(this), event.getButton()); }); this.addSelfEventHandler(ElementEvent.GainFocus.class, event -> { this.field.setFocused(true); }); this.addSelfEventHandler(ElementEvent.LoseFocus.class, event -> { this.field.setFocused(false); }); }
@Override public void init(int x, int y) { compareNbt = addCheckBox(x + 7, y + 77, t("gui.refinedstorage:filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT); compareDamage = addCheckBox(x + 7 + compareNbt.getButtonWidth() + 4, y + 77, t("gui.refinedstorage:filter.compare_damage"), (compare & IComparer.COMPARE_DAMAGE) == IComparer.COMPARE_DAMAGE); compareDamage.visible = type == IType.ITEMS; toggleModFilter = addCheckBox(0, y + 71 + 25, t("gui.refinedstorage:filter.mod_filter"), modFilter); toggleMode = addButton(x + 7, y + 71 + 21, 0, 20, ""); updateModeButton(mode); nameField = new GuiTextField(0, fontRenderer, x + 34, y + 121, 137 - 6, fontRenderer.FONT_HEIGHT); nameField.setText(name); nameField.setEnableBackgroundDrawing(false); nameField.setVisible(true); nameField.setCanLoseFocus(true); nameField.setFocused(false); nameField.setTextColor(16777215); addSideButton(new SideButtonFilterType(this)); }
public ControlTextEdit(final IWidget parent, final int x, final int y, final int width, final int height) { super(parent, x, y, width, height); this.cachedValue = ""; this.field = new GuiTextField(0, this.getWindow().getGui().getFontRenderer(), 0, 0, 10, 10); this.addAttribute(Attribute.CAN_FOCUS); this.addAttribute(Attribute.MOUSE_OVER); this.field.setEnableBackgroundDrawing(false); this.addSelfEventHandler(EventKey.Down.class, event -> { this.field.textboxKeyTyped(event.getCharacter(), event.getKey()); final String text = this.getValue(); if (!text.equals(this.cachedValue)) { this.cachedValue = text; this.callEvent(new EventTextEdit(ControlTextEdit.this, this.cachedValue)); this.onTextEdit(this.cachedValue); } }); this.addSelfEventHandler(EventMouse.Down.class, event -> { this.field.mouseClicked(this.getRelativeMousePosition().xPos(), this.getRelativeMousePosition().yPos(), event.getButton()); }); this.addSelfEventHandler(EventWidget.GainFocus.class, event -> { this.field.setFocused(true); }); this.addSelfEventHandler(EventWidget.LoseFocus.class, event -> { this.field.setFocused(false); }); }
@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); }