@Override public void initGui() { super.initGui(); this.nameField = new GuiTextField(NAME_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 120, 211, 18); this.nameField.setMaxStringLength(23); this.nameField.setText(""); this.nameField.setFocused(false); this.nameField.setVisible(false); this.addControl(this.nameField); this.searchField = new GuiTextField(SEARCH_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 5, 211, 18); this.searchField.setMaxStringLength(23); this.searchField.setText(""); this.searchField.setFocused(true); this.searchField.setVisible(true); this.addControl(this.searchField); this.securedBtn = new GuiButton(SECURED_BUTTON, this.guiLeft + 50, this.guiTop + 167, 100, 18, "Not Secured"); this.securedBtn.visible = false; this.addControl(this.securedBtn); }
@Override protected void keyTyped(char typedChar, int keyCode) throws IOException { boolean textFocused = false; for (Gui control : this.controls) { if (control instanceof GuiTextField) { GuiTextField textField = (GuiTextField) control; if (textField.isFocused()) { textFocused = true; textField.textboxKeyTyped(typedChar, keyCode); break; } } } if (!textFocused || keyCode != Keyboard.KEY_E) super.keyTyped(typedChar, keyCode); }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { GlStateManager.pushMatrix(); GlStateManager.translate(-guiLeft, -guiTop, 0); for (Gui control : this.controls) { if (control instanceof GuiTextField) { ((GuiTextField)control).drawTextBox(); } else if (control instanceof GuiButton) { ((GuiButton)control).drawButton(this.mc, mouseX, mouseY); } } GlStateManager.popMatrix(); super.drawGuiContainerForegroundLayer(mouseX, mouseY); }
@Override public void initGui() { super.initGui(); this.guiLeft = (this.width - this.guiXSize) / 2; this.guiTop = (this.height - this.guiYSize) / 2; if (this.hasBackButton()) { back = new TextureButton(-135, this.guiLeft - 5, this.guiTop + 2, 18, 10, BOOK_EXTRAS, 1, 27, "Go back"); this.buttonList.add(back); } if (this.hasPageLeft()) { left = new TextureButton(-136, this.guiLeft + 20, this.guiTop + guiYSize - 25, 18, 10, BOOK_EXTRAS, 1, 14, "Previous page"); this.buttonList.add(left); } if (this.hasPageRight()) { right = new TextureButton(-137, this.guiLeft + guiXSize - 45, this.guiTop + guiYSize - 25, 18, 10, BOOK_EXTRAS, 1, 1, "Next page"); this.buttonList.add(right); } if (hasSearchBar()) { search = new GuiTextField(-138, this.fontRenderer, this.guiLeft + 20, this.guiTop + 15, 128, 12); search.setMaxStringLength(50); search.setEnableBackgroundDrawing(true); } }
@Override public void initGui() { // xSize = 93; // ySize = 75; Keyboard.enableRepeatEvents(true); this.guiLeft = (this.width - this.xSize) / 2; this.guiTop = (this.height - this.ySize) / 2; channelName = new GuiTextField(0, mc.fontRenderer, this.guiLeft + 7, this.guiTop + 17, 80, mc.fontRenderer.FONT_HEIGHT + 4); channelName.setMaxStringLength(15); channelName.setTextColor(16777215); channelName.setText(terminal.channelName.isEmpty() ? "" : terminal.channelName.substring(terminal.channelName.indexOf(":") + 1)); isPublicChannel = !terminal.channelName.isEmpty() && terminal.channelName.contains("public"); buttonList.clear(); buttonList.add(new GuiButton(ID_CONFIRM, guiLeft + (xSize - 50) / 2, guiTop + ySize + 2, 50, 20, I18n.translateToLocal("gui.done"))); buttonList.add(new GuiButton(ID_PUBLIC_CHANNEL, guiLeft + 6, guiTop + 47, 82, 20, I18n.translateToLocal(isPublicChannel ? "gui.yes" : "gui.no"))); }
public boolean myMouseClicked(int mouseX, int mouseY, int mouseButton) { if (mouseClickedMethod == null) { mouseClickedMethod = Util.findMethod(GuiTextField.class, new String[]{"func_146192_a", "mouseClicked"}, int.class, int.class, int.class); } try { Object result = mouseClickedMethod.invoke(this, mouseX, mouseY, mouseButton); return result == null ? true : Boolean.valueOf(result.toString()); } catch (Throwable t) { return false; } }
/** * 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. */ public void initGui() { if (this.mc.playerController.isInCreativeMode()) { super.initGui(); this.buttonList.clear(); Keyboard.enableRepeatEvents(true); this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRendererObj.FONT_HEIGHT); this.searchField.setMaxStringLength(15); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setVisible(false); this.searchField.setTextColor(16777215); int i = selectedTabIndex; selectedTabIndex = -1; this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_147059_E = new CreativeCrafting(this.mc); this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); } else { this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); } }
@Override public void initGui() { buttonList.add(new GuiButton(0, width / 2 - 100, 60, "Change Key")); buttonList .add(new GuiButton(1, width / 2 - 100, height / 4 + 72, "Save")); buttonList .add(new GuiButton(2, width / 2 - 100, height / 4 + 96, "Cancel")); commandField = new GuiTextField(0, fontRendererObj, width / 2 - 100, 100, 200, 20); commandField.setMaxStringLength(65536); commandField.setFocused(true); if(oldCommands != null) commandField.setText(oldCommands); }
@Override public void initGui() { Keyboard.enableRepeatEvents(true); buttonList.add( new GuiButton(0, width / 2 - 100, height / 3 * 2, 200, 20, "Done")); buttonList.add(new GuiButton(1, width / 2 - 100, height / 3 * 2 + 24, 200, 20, "Cancel")); commandBox = new GuiTextField(0, fontRendererObj, width / 2 - 100, 60, 200, 20); commandBox.setMaxStringLength(100); commandBox.setFocused(true); commandBox.setText("/"); }
@Override public final void initGui() { Keyboard.enableRepeatEvents(true); buttonList.add(doneButton = new GuiButton(0, width / 2 - 100, height / 4 + 72 + 12, getDoneButtonText())); buttonList.add( new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, "Cancel")); buttonList.add(new GuiButton(3, width / 2 - 100, height / 4 + 96 + 12, "Random Name")); buttonList.add(stealSkinButton = new GuiButton(4, width - (width / 2 - 100) / 2 - 64, height - 32, 128, 20, "Steal Skin")); buttonList.add(new GuiButton(5, (width / 2 - 100) / 2 - 64, height - 32, 128, 20, "Open Skin Folder")); emailBox = new GuiTextField(0, fontRendererObj, width / 2 - 100, 60, 200, 20); emailBox.setMaxStringLength(48); emailBox.setFocused(true); emailBox.setText(getDefaultEmail()); passwordBox = new PasswordField(fontRendererObj, width / 2 - 100, 100, 200, 20); passwordBox.setFocused(false); passwordBox.setText(getDefaultPassword()); }
/** * 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. */ public void initGui() { if (this.mc.playerController.isInCreativeMode()) { super.initGui(); this.buttonList.clear(); Keyboard.enableRepeatEvents(true); this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRendererObj.FONT_HEIGHT); this.searchField.setMaxStringLength(15); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setVisible(false); this.searchField.setTextColor(16777215); int i = selectedTabIndex; selectedTabIndex = -1; this.setCurrentCreativeTab(CreativeTabs.CREATIVE_TAB_ARRAY[i]); this.listener = new CreativeCrafting(this.mc); this.mc.player.inventoryContainer.addListener(this.listener); } else { this.mc.displayGuiScreen(new GuiInventory(this.mc.player)); } }
@Override public void initGui() { this.buttonList.clear(); this.teleportField=new GuiTextField(5, fontRenderer, this.width / 2 -40, this.height / 2 - 10, 30, 20); this.teleportField.setMaxStringLength(3); this.teleportField.setFocused(true); this.teleportField.setText(Integer.toString(this.channel+1)); this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 + 5, this.height / 2 + 60, 40, 20, I18n.format("gui.done", new Object[0]))); this.buttonList .add(this.teleportUpBtn = new GuiButton(1, this.width / 2 - 60, this.height / 2 - 10, 20, 20, "+")); this.buttonList .add(this.teleportDownBtn = new GuiButton(2, this.width / 2 - 10, this.height / 2 - 10, 20, 20, "-")); this.buttonList .add(this.exitToggle = new GuiButton(3, this.width / 2 + 10, this.height / 2 - 10, 50, 20, "Exit")); this.buttonList.add(this.grab = new GuiButton(4, this.width / 2 - 45, this.height / 2 + 60, 40, 20, I18n.format("gui.teleporter.drop", new Object[0]))); }
public StringEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value) { super(owningScreen, owningEntryList, configElement); this.textFieldValue = new GuiTextField(0, owningEntryList.getMC().fontRendererObj, owningEntryList.width / 4 + 1, 0, owningEntryList.controlWidth - 3, 16); this.textFieldValue.setMaxStringLength(10000); this.textFieldValue.setText(value.toString()); this.isValidated = configElement.getValidationPattern() != null; if (configElement.getValidationPattern() != null) { if (configElement.getValidationPattern().matcher(this.textFieldValue.getText().trim()).matches()) isValidValue = true; else isValidValue = false; } }
@Override public void initGui() { super.initGui(); this.buttonList.add(addButton = new GuiButton(0, this.width / 2 - 155, this.height - 29, 150, 20, I18n.format("gui.createkeybindings.saveBind", new Object[0]))); this.buttonList.add(cancelButton = new GuiButton(1, this.width / 2 - 155 + 160, this.height - 29, 150, 20, I18n.format("gui.cancel", new Object[0]))); this.buttonList.add(this.btnKeyBinding = new GuiButton(3, this.width / 2 - 75, 100, 150, 20, GameSettings.getKeyDisplayString(0))); this.buttonList.add(this.repeatCommand = new GuiButton(4, this.width / 2 - 75, 140, 75, 20, I18n.format("disabled", new Object[0]))); this.buttonList.add(this.commandActive = new GuiButton(5, this.width / 2 - 75, 163, 75, 20, I18n.format("disabled", new Object[0]))); this.command = new GuiTextField(9, this.fontRenderer, this.width / 2 - 100, 50, 200, 20); this.command.setFocused(true); this.command.setMaxStringLength(Integer.MAX_VALUE); if(editing){ command.setText(result.getCommand()); this.btnKeyBinding.displayString = GameSettings.getKeyDisplayString(result.getKeyCode()); this.repeatCommand.displayString = repeatEnabled?I18n.format("enabled", new Object[0]):I18n.format("disabled", new Object[0]); this.commandActive.displayString = isCommandActive ? I18n.format("enabled", new Object[0]) : I18n.format("disabled", new Object[0]); } }
/** * Adds the buttons (and other controls) to the screen in question. */ @Override public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("simpleDimensions.create", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); this.buttonList.add(this.btnMoreOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, I18n.format("simpleDimensions.moreDimensionOptions", new Object[0]))); this.buttonList.add(this.btnStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, I18n.format("selectWorld.mapFeatures", new Object[0]))); this.btnStructures.visible = false; this.buttonList.add(this.btnDimensionType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, I18n.format("selectWorld.mapType", new Object[0]))); this.btnDimensionType.visible = false; this.buttonList.add(this.btnCustomizeType = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, I18n.format("selectWorld.customizeType", new Object[0]))); this.btnCustomizeType.visible = false; this.dimensionNameTextField = new GuiTextField(9, this.fontRenderer, this.width / 2 - 100, 60, 200, 20); this.dimensionNameTextField.setFocused(true); this.dimensionNameTextField.setText(this.field_146330_J); this.seedTextField = new GuiTextField(10, this.fontRenderer, this.width / 2 - 100, 60, 200, 20); this.seedTextField.setText(this.field_146329_I); this.showMoreWorldOptions(this.userInMoreOptions); this.func_146314_g(); this.updateDisplayState(); }
/** * 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. */ public void initGui() { this.buttonList.clear(); Keyboard.enableRepeatEvents(true); this.presetsTitle = I18n.format("createWorld.customize.presets.title", new Object[0]); this.presetsShare = I18n.format("createWorld.customize.presets.share", new Object[0]); this.field_146436_r = I18n.format("createWorld.customize.presets.list", new Object[0]); this.field_146433_u = new GuiTextField(2, this.fontRenderer, 50, 40, this.width - 100, 20); this.field_146435_s = new GuiFlatDimensionPresets.ListSlot(); this.field_146433_u.setMaxStringLength(1230); this.field_146433_u.setText(this.parentScreen.getPreset()); this.buttonList.add(this.field_146434_t = new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("createWorld.customize.presets.select", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); this.func_146426_g(); }
/** * 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. */ public void initGui() { this.buttonList.clear(); Keyboard.enableRepeatEvents(true); this.field_175315_a = I18n.format("createWorld.customize.custom.presets.title", new Object[0]); this.field_175313_s = I18n.format("createWorld.customize.presets.share", new Object[0]); this.field_175312_t = I18n.format("createWorld.customize.presets.list", new Object[0]); this.field_175317_i = new GuiTextField(2, this.fontRenderer, 50, 40, this.width - 100, 20); this.field_175311_g = new GuiScreenCustomizeDimensionPresets.ListPreset(); this.field_175317_i.setMaxStringLength(2000); this.field_175317_i.setText(this.customizeDimensionGui.func_175323_a()); this.buttonList.add(this.field_175316_h = new GuiButton(0, this.width / 2 - 102, this.height - 27, 100, 20, I18n.format("createWorld.customize.presets.select", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 + 3, this.height - 27, 100, 20, I18n.format("gui.cancel", new Object[0]))); this.func_175304_a(); }
@Override public void initGui(){ super.initGui(); refreshButtons(); for(int i = 0; i < 5; i++){ stockFeilds[i] = new GuiTextField(i, fontRendererObj, guiLeft+26, guiTop+22 + (18*i), 69 - 6, fontRendererObj.FONT_HEIGHT); stockFeilds[i].setEnableBackgroundDrawing(true); stockFeilds[i].setVisible(true); stockFeilds[i].setText(String.valueOf(stocker.stockAmts[i])); stockFeilds[i].setTextColor(16777215); stockFeilds[i].setCanLoseFocus(false); } for(int i = 0; i < 5; i++){ amountFeilds[i] = new GuiTextField(i+4, fontRendererObj, guiLeft+26+69, guiTop+22 + (18*i), 30, fontRendererObj.FONT_HEIGHT); amountFeilds[i].setEnableBackgroundDrawing(true); amountFeilds[i].setVisible(true); amountFeilds[i].setMaxStringLength(3); amountFeilds[i].setText(String.valueOf(stocker.craftAmounts[i])); amountFeilds[i].setTextColor(16777215); amountFeilds[i].setCanLoseFocus(false); } }
@Override public void initGui() { this.reponse = this.getRandomString(); this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 150, 50, 300, 20); this.textfield.setMaxStringLength(300); this.textfield.setFocused(true); this.factory = new ChatterBotFactory(); try { this.bot = this.factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477"); this.bot_session = this.bot.createSession(); } catch (Exception e) { e.printStackTrace(); } this.buttonList.add(new GuiButton(42, this.width / 4, this.height - 40, this.width / 2, 20, ChatColor.RESET + "Say")); }
public StringEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value) { super(owningScreen, owningEntryList, configElement); this.textFieldValue = new GuiTextField(owningEntryList.mc.field_71466_p, owningEntryList.field_148155_a / 4 + 1, 0, owningEntryList.controlWidth - 3, 16); this.textFieldValue.func_146203_f(10000); this.textFieldValue.func_146180_a(value.toString()); this.isValidated = configElement.getValidationPattern() != null; if (configElement.getValidationPattern() != null) { if (configElement.getValidationPattern().matcher(this.textFieldValue.func_146179_b().trim()).matches()) isValidValue = true; else isValidValue = false; } }
@Override public void onTick() { if (this.repairGuiTask==null||!(this.repairGuiTask instanceof GuiRepair)) return; final EntryId entryId = CurrentMode.instance.getEntryId(); if (!entryId.isNameable()) return; try { final GuiTextField textField = guiRepairTextField.get(this.repairGuiTask); final ContainerRepair containerRepair = guiRepairContainer.get(this.repairGuiTask); if (textField!=null&&containerRepair!=null) { final String text = textField.getText(); if (!StringUtils.isEmpty(text)&&!StringUtils.equals(this.repairGuiTextFieldCache, text)) { final String name = entryId.id(); Sign.setRepairName(name, textField, containerRepair); this.repairGuiTextFieldCache = name; } } return; } catch (final Exception e) { Log.notice(I18n.format("signpic.chat.error.place")); } Log.notice(I18n.format("signpic.chat.error.place")); }
@Override public void initGui() { this.buttonList.clear(); ScaledResolution resolution = new ScaledResolution(this.mc); int scaledWidth = resolution.getScaledWidth(); int scaledHeight = resolution.getScaledHeight(); this.buttonList.add(new GuiButton(0, (scaledWidth / 2) - 100, scaledHeight - 30, "Teleport To")); this.buttonList.add(new GuiButton(1, (scaledWidth / 2) - 100, (scaledHeight / 4) + 10, "Preview")); this.placeField = new GuiTextField(9, this.fontRendererObj, this.width / 2 - 200, (scaledHeight / 4) - 20, 400, 20); this.placeField.setFocused(true); this.placeField.setText(this.place); this.placeField.setMaxStringLength(255); }
@Override public void initGui() { int x = 8; int y = 8; int w = 120 - x * 2; int h = 20; /* Initiate fields */ this.done = new GuiButton(0, this.width - 80 - x, this.height - y - h, 80, h, I18n.format("blockbuster.gui.done")); this.reset = new GuiButton(1, x, this.height - y - h, w, h, I18n.format("blockbuster.gui.reset")); this.replayName = new GuiTextField(20, this.fontRendererObj, x + 1, y + 16, w - 2, h - 2); /* Adding GUI elements */ this.buttonList.add(this.done); this.buttonList.add(this.reset); this.replays.updateRect(-1, y + 45, 122, (this.height - y * 3 - h - 45)); this.replay.initGui(); if (this.modal != null) { this.modal.initiate(); } }
@Override public void initiate() { super.initiate(); int x = this.x + this.width; int y = this.y + this.height; this.models.updateRect(this.x + 11, this.y + 50, this.width - 22, this.height - 90); this.models.initiate(); this.search = new GuiTextField(0, this.font, this.parent.width / 2 - this.width / 2 + 12, this.parent.height / 2 - this.height / 2 + 32, this.width - 24, 18); this.button = new GuiButton(this.id, x - this.width + 10, y - 41, this.width - 20, 20, I18n.format("blockbuster.gui.done")); this.buttons.clear(); this.buttons.add(this.button); }
public GuiPoseModal(int add_id, int remove_id, int select_id, GuiScreen parent, FontRenderer font) { super(parent, font); this.name = new GuiTextField(0, font, 0, 0, 0, 18); this.done = new GuiButton(-1, 0, 0, 0, 20, I18n.format("blockbuster.gui.done")); this.add = new GuiButton(add_id, 0, 0, 0, 20, I18n.format("blockbuster.gui.add")); this.remove = new GuiButton(remove_id, 0, 0, 0, 20, I18n.format("blockbuster.gui.remove")); this.select = new GuiButton(select_id, 0, 0, 0, 20, I18n.format("blockbuster.gui.select")); this.size = new GuiThreeInput(-2, font, 0, 0, 0, this); this.buttons.add(this.done); this.buttons.add(this.add); this.buttons.add(this.remove); this.buttons.add(this.select); this.poses = new GuiPosesView(parent); this.updatePoses(); this.height = 122 + 20; this.label = I18n.format("blockbuster.gui.me.pose_title_modal"); }
@Override public void initGui() { ySize = 176; xSize = 210; labelList.clear(); super.initGui(); fieldName = new GuiTextField(0, fontRenderer, guiLeft + 6, guiTop + 6, 50, 10); fieldName.setMaxStringLength(30); fieldName.setTextColor(0xffffff); TomsModUtils.addTextFieldToLabelList(fieldName, labelList); if (entry != null) fieldName.setText(entry.getName()); offsetX = new GuiNumberValueBox(0, guiLeft + 5, guiTop + 20, 32, -32); offsetY = new GuiNumberValueBox(1, guiLeft + 5, guiTop + 30, 32, -32); offsetZ = new GuiNumberValueBox(2, guiLeft + 5, guiTop + 40, 32, -32); offsetX.addToList(buttonList); offsetY.addToList(buttonList); offsetZ.addToList(buttonList); offsetX.num = entry.getOffsetX(); offsetY.num = entry.getOffsetY(); offsetZ.num = entry.getOffsetZ(); TomsModUtils.addNumberValueBoxToLabelList(offsetX, labelList); TomsModUtils.addNumberValueBoxToLabelList(offsetY, labelList); TomsModUtils.addNumberValueBoxToLabelList(offsetZ, labelList); }
@Override public void initGui() { this.xSize = 256; this.ySize = 216; labelList.clear(); super.initGui(); whiteListButton = new GuiButton(0, guiLeft + 10, guiTop + 72, 15, 20, "B"); buttonList.add(whiteListButton); metaButton = new GuiButton(1, guiLeft + 25, guiTop + 72, 30, 20, TextFormatting.GREEN + "Meta"); buttonList.add(metaButton); modButton = new GuiButton(2, guiLeft + 56, guiTop + 72, 30, 20, TextFormatting.RED + "Mod"); buttonList.add(modButton); nbtButton = new GuiButton(3, guiLeft + 87, guiTop + 72, 30, 20, TextFormatting.GREEN + "NBT"); buttonList.add(nbtButton); buttonSelection = new GuiButtonDefenseStationSelection(4, guiLeft + 5, guiTop + 25, te.config); buttonList.add(buttonSelection); buttonRedstone = new GuiButtonRedstoneMode(5, guiLeft + 202, guiTop + 7, te.rsMode); buttonList.add(buttonRedstone); playerButton = new GuiButton(6, guiLeft + 10, guiTop + 51, 50, 20, I18n.format("tomsmod.gui.generic")); buttonList.add(playerButton); fieldName = new GuiTextField(0, fontRenderer, guiLeft + 6, guiTop + 6, 126, 15); fieldName.setMaxStringLength(30); fieldName.setTextColor(0xffffff); TomsModUtils.addTextFieldToLabelList(fieldName, labelList); }
private void setCoords(GuiTextField field, int index) { if (field.getText() != null && !field.getText().trim().isEmpty()) { int coord; if (index == 0) { coord = parseInt(tileEntity.getControlPanel().targetX, field.getText()); tileEntity.getControlPanel().targetX = coord; } else { coord = parseInt(tileEntity.getControlPanel().targetZ, field.getText()); tileEntity.getControlPanel().targetZ = coord; } FissionWarfare.network.sendToServer(new ServerPacketHandler("set.coords%" + tileEntity.xCoord + "%" + tileEntity.yCoord + "%" + tileEntity.zCoord + "%" + index + "%" + coord)); } }
public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.nameField = new GuiTextField(0, this.fontRendererObj, i + 62, j + 24, 103, 12); this.nameField.setTextColor(-1); this.nameField.setDisabledTextColour(-1); this.nameField.setEnableBackgroundDrawing(false); this.nameField.setMaxStringLength(30); this.inventorySlots.removeCraftingFromCrafters(this); this.inventorySlots.onCraftGuiOpened(this); int x = i + 180; int y = j; for (int r = 0; r < 4; r++) { for (int l = 0; l < 5; l++) { GuiCustomButton button = new GuiCustomButton(r * 5 + l, x + 18 * l, y + 18 * r, 16, 16, "\u00a7" + ColorType.byId(r * 5 + l).getCode() + "" + ColorType.byId(r * 5 + l).getCode()); button.enabled = false; buttonList.add(button); } } }
@Override public void initGui () { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0]))); this.buttonList.add(this.cancelBtn = new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0]))); this.loreText = new GuiTextField(2, this.fontRenderer, this.width / 2 - 150, 50, 300, 20); this.loreText.setMaxStringLength(48); this.loreText.setFocused(true); this.loreText.setTextColor(this.type.getColor()); final List<String> lore = StackUtils.getLore(this.stack); if (!lore.isEmpty()) { this.loreText.setText(lore.get(0)); } this.doneBtn.enabled = this.loreText.getText().trim().length() > 0 && StringUtils.isNumeric(this.loreText.getText()); }
@Override public void initGui() { Keyboard.enableRepeatEvents(true); accountsgui = new GuiAccountSelector.List(this.mc); accountsgui.registerScrollButtons(5, 6); query = I18n.format("ias.search"); this.buttonList.clear(); //Above Top Row this.buttonList.add(reloadskins = new GuiButton(8, this.width / 2 - 154 - 10, this.height - 76 - 8, 120, 20, I18n.format("ias.reloadskins"))); //Top Row this.buttonList.add(new GuiButton(0, this.width / 2 + 4 + 40, this.height - 52, 120, 20, I18n.format("ias.addaccount"))); this.buttonList.add(login = new GuiButton(1, this.width / 2 - 154 - 10, this.height - 52, 120, 20, I18n.format("ias.login"))); this.buttonList.add(edit = new GuiButton(7, this.width / 2 - 40, this.height - 52, 80, 20, I18n.format("ias.edit"))); //Bottom Row this.buttonList.add(loginoffline = new GuiButton(2, this.width / 2 - 154 - 10, this.height - 28, 110, 20, I18n.format("ias.login") + " " + I18n.format("ias.offline"))); this.buttonList.add(new GuiButton(3, this.width / 2 + 4 + 50, this.height - 28, 110, 20, I18n.format("gui.cancel"))); this.buttonList.add(delete = new GuiButton(4, this.width / 2 - 50, this.height - 28, 100, 20, I18n.format("ias.delete"))); search = new GuiTextField(8, this.fontRenderer, this.width / 2 - 80, 14, 160, 16); search.setText(query); updateButtons(); if (!queriedaccounts.isEmpty()) SkinTools.buildSkin(queriedaccounts.get(selectedAccountIndex).alias); }
@Override public void initGui() { super.initGui(); Keyboard.enableRepeatEvents(true); taskMsg = new GuiTextField(2, fontRenderer, guiLeft + 8, guiTop + 50, 107, 10); ItemStack oldStack = ItemStack.EMPTY; if (btnState != null) oldStack = btnState.getTargetStack(); btnState = new GuiButtonBlockState(2, guiLeft + 138, guiTop + 21); IBlockState hoveredState = FMLClientHandler.instance().getWorldClient().getBlockState(ClientProxy.mc.objectMouseOver.getBlockPos()); Block hoveredBlock = hoveredState.getBlock(); ItemStack stackFromHoveredBlock = new ItemStack(hoveredBlock, 1, hoveredBlock.getMetaFromState(hoveredState)); btnState.setDisplayStack(stackFromHoveredBlock); if (!oldStack.isEmpty()) btnState.setDisplayStack(oldStack); btnAccept = new GuiButton(1, guiLeft + 128, guiTop + 50, 40, 20, I18n.format("gui.done")); buttonList.add(btnAccept); buttonList.add(btnState); }
@Override public void initGui() { super.initGui(); this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 10, this.guiTop + 6, 80, this.fontRendererObj.FONT_HEIGHT); this.searchField.setMaxStringLength(20); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setTextColor(0xFFFFFF); this.searchField.setCanLoseFocus(true); this.searchField.setFocused(true); this.searchField.setText(""); this.jeiSearchToggle = new GuiCheckBoxCustom(0, this.guiLeft + 83, this.guiTop + 4, "\u2714", tileEntity.jeiLink); this.jeiSearchToggle.visible = false; if (JEIUtils.isJEIAvailable()) { this.searchField.width = 64; } else { this.jeiSearchToggle.enabled = false; } filteredList = new ArrayList<ItemGroup>(this.tileEntity.inventory.inventory); buttonList.add(modeToggle = new GuiButton(0, guiLeft - 100, guiTop + 16, 90, 20, "")); buttonList.add(craftClear = new ButtonBlue(0, guiLeft + 20, guiTop + 100, 14, 14, "x")); buttonList.add(jeiSearchToggle); modeToggle.visible = false; craftClear.visible = false; }
/** * Adds the buttons (and other controls) to the screen in question. */ @SuppressWarnings("unchecked") @Override public void initGui() { Keyboard.enableRepeatEvents(true); buttonList.clear(); buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, "Search")); buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, "Back")); ipBox = new GuiTextField(0, fontRendererObj, width / 2 - 100, height / 4 + 34, 200, 20); ipBox.setMaxStringLength(15); ipBox.setFocused(true); maxThreadsBox = new GuiTextField(1, fontRendererObj, width / 2 - 32, height / 4 + 58, 26, 12); maxThreadsBox.setMaxStringLength(3); maxThreadsBox.setFocused(false); maxThreadsBox.setText(Integer.toString(WurstClient.INSTANCE.options.serverFinderThreads)); running = false; terminated = false; WurstClient.INSTANCE.analytics.trackPageView("/multiplayer/server-finder", "Server Finder"); }
public GuiColourPicker(Minecraft minecraft, int controlId, int xPos, int yPos, int initialColor, String displayText) { super(minecraft, controlId, xPos, yPos, 206, 173, displayText); Color color = new Color(initialColor); this.hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); this.fontRenderer = minecraft.fontRendererObj; this.txtRed = new GuiTextField(controlId++,this.fontRenderer, this.xPosition + 163, this.yPosition + 10, 42, 16); this.txtGreen = new GuiTextField(controlId++,this.fontRenderer, this.xPosition + 163, this.yPosition + 30, 42, 16); this.txtBlue = new GuiTextField(controlId++,this.fontRenderer, this.xPosition + 163, this.yPosition + 50, 42, 16); this.txtRed.setMaxStringLength(3); this.txtGreen.setMaxStringLength(3); this.txtBlue.setMaxStringLength(3); this.rectHSArea = new Rectangle(this.xPosition + 10, this.yPosition + 10, 128, 128); this.rectBArea = new Rectangle(this.xPosition + 143, this.yPosition + 10, 15, 128); this.btnOk = new GuiControl(minecraft, 0, this.xPosition + 9, this.yPosition + 145, 55, 20, "ok"); //TODO add support for .lang files this.btnCancel = new GuiControl(minecraft, 1, this.xPosition + 70, this.yPosition + 145, 65, 20, "cancel");//TODO add support for .lang files this.updateColor(); }
@Override public void initGui() { super.initGui(); infinite = tileEntity.infiniteMode; infiniteButton = new GuiSlimButton(idInfiniteButton, 9 + (width - xSize) / 2, 54 + (height - ySize) / 2, 148, 12, infinite ? I18n.format("vendor.wrench.infiniteon") : I18n.format("vendor.wrench.infiniteoff")); editButton = new GuiSlimButton(idEditButton, 68 + (width - xSize) / 2, 34 + (height - ySize) / 2, 40, 12, I18n.format("general.button.edit")); applyButton = new GuiSlimButton(idApplyButton, 110 + (width - xSize) / 2, 34 + (height - ySize) / 2, 40, 12, I18n.format("general.button.save")); buttonList.clear(); buttonList.add(editButton); buttonList.add(applyButton); buttonList.add(infiniteButton); blockOwnerField = new GuiTextField(0, this.fontRenderer, 12, 20, 138, 13); blockOwnerField.setFocused(false); blockOwnerField.setMaxStringLength(100); blockOwnerField.setText(tileEntity.blockOwner); blockOwnerField.setEnableBackgroundDrawing(true); }
@Override public void initGui() { super.initGui(); buttonOne = new GuiSlimButton(idButtonOne, 8 + (width - xSize) / 2, 30 + (height - ySize) / 2, 18, 12, ""); buttonTwo = new GuiSlimButton(idButtonTwo, 8 + (width - xSize) / 2, 50 + (height - ySize) / 2, 18, 12, ""); buttonThree = new GuiSlimButton(idButtonThree, 8 + (width - xSize) / 2, 70 + (height - ySize) / 2, 18, 12, ""); buttonFour = new GuiSlimButton(idButtonFour, 8 + (width - xSize) / 2, 90 + (height - ySize) / 2, 18, 12, ""); buttonList.clear(); buttonList.add(buttonOne); buttonList.add(buttonTwo); buttonList.add(buttonThree); buttonList.add(buttonFour); textField = new GuiTextField(0, this.fontRenderer, 1, 1, 100, 13); textField.setFocused(false); textField.setMaxStringLength(9); textField.setText("0"); }
public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); textFieldList.add(waypointNameField = new GuiTextField(1, fontRendererObj, this.width / 2 - 100, this.height / 4 - 16, 200, 20)); textFieldList.add(waypointXField = new GuiTextField(2, fontRendererObj, this.width / 2 - 100, this.height / 4 + 8, 64, 20)); textFieldList.add(waypointYField = new GuiTextField(2, fontRendererObj, this.width / 2 - 32, this.height / 4 + 8, 64, 20)); textFieldList.add(waypointZField = new GuiTextField(2, fontRendererObj, this.width / 2 + 36, this.height / 4 + 8, 64, 20)); waypointNameField.setText(point.getName()); waypointXField.setText(String.valueOf((int)point.getX())); waypointYField.setText(String.valueOf((int)point.getY())); waypointZField.setText(String.valueOf((int)point.getZ())); this.buttonList.add(redSlider = new GuiSlider(0, this.width / 2 - 100, this.height / 4 + 32, 1.0F, 0.0F, "Red", point.getRed())); this.buttonList.add(greenSlider = new GuiSlider(0, this.width / 2 - 100, this.height / 4 + 56, 1.0F, 0.0F, "Green", point.getGreen())); this.buttonList.add(blueSlider = new GuiSlider(0, this.width / 2 - 100, this.height / 4 + 80, 1.0F, 0.0F, "Blue", point.getBlue())); this.buttonList.add(saveButton = new GuiButton(100, this.width / 2 - 100, this.height / 4 + 152, "Save")); waypointNameField.setFocused(true); }