@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(); 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(); 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; }
amountField.setText(String.valueOf(getDefaultAmount())); amountField.setTextColor(16777215); amountField.setCanLoseFocus(false); amountField.setFocused(true);
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; }
cursorX = cursorY = -1; searchField = new GuiTextField(0, fontRenderer, 0, 0, 70, 10); searchField.setCanLoseFocus(false); searchField.setFocused(true); searchField.setEnableBackgroundDrawing(false);
@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 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 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)); }