use of net.minecraft.client.gui.GuiTextField in project Railcraft by Railcraft.
the class GuiAnvil method initGui.
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui() {
super.initGui();
Keyboard.enableRepeatEvents(true);
int i = (width - xSize) / 2;
int j = (height - ySize) / 2;
this.itemNameField = new GuiTextField(0, fontRenderer, i + 62, j + 24, 103, 12);
itemNameField.setTextColor(-1);
itemNameField.setDisabledTextColour(-1);
itemNameField.setEnableBackgroundDrawing(false);
itemNameField.setMaxStringLength(40);
inventorySlots.removeListener(this);
inventorySlots.addListener(this);
}
use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.
the class GuiTabArmourerDisplaySettings method initGui.
@Override
public void initGui(int xPos, int yPos, int width, int height) {
super.initGui(xPos, yPos, width, height);
String guiName = tileEntity.getInventoryName();
buttonList.clear();
checkShowGuides = new GuiCheckBox(7, 10, 95, GuiHelper.getLocalizedControlName(guiName, "showGuide"), tileEntity.isShowGuides());
checkShowOverlay = new GuiCheckBox(9, 10, 110, GuiHelper.getLocalizedControlName(guiName, "showOverlay"), tileEntity.isShowOverlay());
checkShowHelper = new GuiCheckBox(6, 10, 110, GuiHelper.getLocalizedControlName(guiName, "showHelper"), tileEntity.isShowHelper());
buttonList.add(new GuiButtonExt(8, width - 36 - 5, 70, 30, 16, GuiHelper.getLocalizedControlName(guiName, "set")));
textUserSkin = new GuiTextField(fontRenderer, x + 10, y + 70, 120, 16);
textUserSkin.setMaxStringLength(300);
textUserSkin.setText(tileEntity.getTexture().getTextureString());
textureTypeList = new GuiDropDownList(0, 10, 30, 50, "", this);
textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.user"), TextureType.USER.toString(), true);
textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.url"), TextureType.URL.toString(), true);
textureTypeList.setListSelectedIndex(tileEntity.getTexture().getTextureType().ordinal());
buttonList.add(checkShowGuides);
buttonList.add(checkShowOverlay);
buttonList.add(checkShowHelper);
buttonList.add(textureTypeList);
}
use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.
the class GuiTabArmourerMain method initGui.
@Override
public void initGui(int xPos, int yPos, int width, int height) {
super.initGui(xPos, yPos, width, height);
String guiName = tileEntity.getInventoryName();
buttonList.clear();
SkinTypeRegistry str = SkinTypeRegistry.INSTANCE;
GuiDropDownList dropDownList = new GuiDropDownList(0, 10, 20, 50, "", this);
ArrayList<ISkinType> skinList = str.getRegisteredSkinTypes();
int skinCount = 0;
for (int i = 0; i < skinList.size(); i++) {
ISkinType skinType = skinList.get(i);
if (!skinType.isHidden()) {
String skinLocalizedName = str.getLocalizedSkinTypeName(skinType);
String skinRegistryName = skinType.getRegistryName();
dropDownList.addListItem(skinLocalizedName, skinRegistryName, skinType.enabled());
if (skinType == tileEntity.getSkinType()) {
dropDownList.setListSelectedIndex(skinCount);
}
skinCount++;
}
}
buttonList.add(dropDownList);
buttonList.add(new GuiButtonExt(13, 86, 16, 50, 12, GuiHelper.getLocalizedControlName(guiName, "save")));
buttonList.add(new GuiButtonExt(14, 86, 16 + 13, 50, 12, GuiHelper.getLocalizedControlName(guiName, "load")));
textItemName = new GuiTextField(fontRenderer, x + 64, y + 58, 103, 16);
textItemName.setMaxStringLength(40);
textItemName.setText(tileEntity.getSkinProps().getPropertyString(Skin.KEY_CUSTOM_NAME, ""));
}
use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.
the class GuiMannequinTabTexture method initGui.
@Override
public void initGui(int xPos, int yPos, int width, int height) {
super.initGui(xPos, yPos, width, height);
textureTypeList = new GuiDropDownList(0, width / 2 - 110, 25, 50, "", this);
textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.user"), TextureType.USER.toString(), true);
textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.url"), TextureType.URL.toString(), true);
textureTypeList.setListSelectedIndex(tileEntity.getTextureType().ordinal());
nameTextbox = new GuiTextField(fontRenderer, width / 2 - 110 + 55, 25, 165, 14);
nameTextbox.setMaxStringLength(300);
if (tileEntity.getTextureType() == TextureType.USER) {
if (tileEntity.getGameProfile() != null) {
nameTextbox.setText(tileEntity.getGameProfile().getName());
}
} else {
if (tileEntity.getImageUrl() != null) {
nameTextbox.setText(tileEntity.getImageUrl());
}
}
setNameButton = new GuiButtonExt(0, width / 2 + 60, 45, 50, 14, GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "set"));
setNameButton.width = fontRenderer.getStringWidth(setNameButton.displayString + " ");
setNameButton.xPosition = width / 2 + TAB_WIDTH / 2 - setNameButton.width - 10;
buttonList.add(textureTypeList);
buttonList.add(setNameButton);
}
use of net.minecraft.client.gui.GuiTextField in project BiomesOPlenty by Glitchfiend.
the class GuiBOPPageTable method keyTyped.
@Override
public void keyTyped(char typedChar, int keyCode) {
if (this.focusedGui instanceof GuiTextField) {
GuiTextField guitextfield = (GuiTextField) this.focusedGui;
int j;
// Check if aren't we are pasting text
if (!GuiScreen.isKeyComboCtrlV(keyCode)) {
if (// Tab is pressed
keyCode == 15) {
guitextfield.setFocused(false);
int focusedGuiIndex = this.allTextFieldGuis.indexOf(this.focusedGui);
if (GuiScreen.isShiftKeyDown()) {
if (// Jump back to the end of the list when at the start
focusedGuiIndex == 0) {
focusedGuiIndex = this.allTextFieldGuis.size() - 1;
} else {
// Cycle backwards through the text fields
--focusedGuiIndex;
}
} else if (// Jump back to the start of the list when at the end
focusedGuiIndex == this.allTextFieldGuis.size() - 1) {
focusedGuiIndex = 0;
} else {
// Cycle forwards through the text fields
++focusedGuiIndex;
}
this.focusedGui = this.allTextFieldGuis.get(focusedGuiIndex);
guitextfield = (GuiTextField) this.focusedGui;
guitextfield.setFocused(true);
int k1 = guitextfield.y + this.slotHeight;
j = guitextfield.y;
if (k1 > this.bottom) {
this.amountScrolled += (float) (k1 - this.bottom);
} else if (j < this.top) {
this.amountScrolled = (float) j;
}
} else {
guitextfield.textboxKeyTyped(typedChar, keyCode);
}
} else {
String s = GuiScreen.getClipboardString();
String[] astring = s.split(";");
j = this.allTextFieldGuis.indexOf(this.focusedGui);
int k = j;
String[] astring1 = astring;
int l = astring.length;
for (int i1 = 0; i1 < l; ++i1) {
String s1 = astring1[i1];
this.allTextFieldGuis.get(k).setText(s1);
if (k == this.allTextFieldGuis.size() - 1) {
k = 0;
} else {
++k;
}
if (k == j) {
break;
}
}
}
}
}
Aggregations