本文整理汇总了Java中net.minecraft.client.gui.GuiTextField类的典型用法代码示例。如果您正苦于以下问题:Java GuiTextField类的具体用法?Java GuiTextField怎么用?Java GuiTextField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiTextField类属于net.minecraft.client.gui包,在下文中一共展示了GuiTextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyTyped
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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);
}
示例2: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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);
}
示例3: drawGuiContainerForegroundLayer
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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);
}
示例4: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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);
}
}
示例5: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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")));
}
示例6: myMouseClicked
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
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;
}
}
示例7: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
/**
* 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));
}
}
示例8: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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);
}
示例9: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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("/");
}
示例10: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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());
}
示例11: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
/**
* 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));
}
}
示例12: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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])));
}
示例13: StringEntry
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
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;
}
}
示例14: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
@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]);
}
}
示例15: initGui
import net.minecraft.client.gui.GuiTextField; //导入依赖的package包/类
/**
* 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();
}