use of net.minecraft.client.gui.GuiTextField in project MinecraftForge by MinecraftForge.
the class GuiModList method initGui.
@Override
public void initGui() {
int slotHeight = 35;
for (ModContainer mod : mods) {
listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getName()) + 10);
listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight);
}
listWidth = Math.min(listWidth, 150);
this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight);
this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done")));
configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config");
disableModButton = new GuiButton(21, 10, this.height - 27, this.listWidth, 20, "Disable");
this.buttonList.add(configModButton);
this.buttonList.add(disableModButton);
search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14);
search.setFocused(true);
search.setCanLoseFocus(true);
int width = (modList.listWidth / numButtons);
int x = 10, y = 10;
GuiButton normalSort = new GuiButton(SortType.NORMAL.buttonID, x, y, width - buttonMargin, 20, I18n.format("fml.menu.mods.normal"));
normalSort.enabled = false;
buttonList.add(normalSort);
x += width + buttonMargin;
buttonList.add(new GuiButton(SortType.A_TO_Z.buttonID, x, y, width - buttonMargin, 20, "A-Z"));
x += width + buttonMargin;
buttonList.add(new GuiButton(SortType.Z_TO_A.buttonID, x, y, width - buttonMargin, 20, "Z-A"));
updateCache();
}
use of net.minecraft.client.gui.GuiTextField in project BluePower by Qmunity.
the class GuiGateWireless method initGui.
@Override
public void initGui() {
super.initGui();
Keyboard.enableRepeatEvents(true);
Mouse.getDWheel();
addWidget(accessLevel = new WidgetMode(0, guiLeft + 10, guiTop + ySize - 24, 228, 0, Accessibility.values().length, Refs.MODID + ":textures/gui/wirelessRedstone.png") {
@Override
public void addTooltip(int mouseX, int mouseY, List<String> curTip, boolean shiftPressed) {
curTip.add((accessLevel.enabled ? "" : EnumChatFormatting.GRAY) + "Accessability");
}
});
addWidget(filterAccessLevel = new WidgetMode(1, guiLeft + 12, guiTop + 35, 228, 0, Accessibility.values().length + 2, Refs.MODID + ":textures/gui/wirelessRedstone.png"));
filterAccessLevel.value = 4;
addWidget(addFrequency = new WidgetMode(3, guiLeft + 10, guiTop + ySize - 24 - 14 - 3, 228 + 14, 0, 1, Refs.MODID + ":textures/gui/wirelessRedstone.png") {
@Override
public void addTooltip(int mouseX, int mouseY, List<String> curTip, boolean shiftPressed) {
curTip.add((addFrequency.enabled ? "" : EnumChatFormatting.GRAY) + "Add frequency");
}
});
addWidget(saveFrequency = new WidgetMode(4, guiLeft + 37, guiTop + ySize - 24 - 14 - 3, 228 + 14, 28, 1, Refs.MODID + ":textures/gui/wirelessRedstone.png") {
@Override
public void addTooltip(int mouseX, int mouseY, List<String> curTip, boolean shiftPressed) {
curTip.add((saveFrequency.enabled ? "" : EnumChatFormatting.GRAY) + "Save changes");
}
});
addWidget(removeFrequency = new WidgetMode(5, guiLeft + 88 - 10 - 14, guiTop + ySize - 24 - 14 - 3, 228 + 14, 14, 1, Refs.MODID + ":textures/gui/wirelessRedstone.png") {
@Override
public void addTooltip(int mouseX, int mouseY, List<String> curTip, boolean shiftPressed) {
if (gate.getFrequency() != null && (selected == null || selected.equals(gate.getFrequency()))) {
curTip.add("Unselect frequency");
} else if (selected != null) {
curTip.add("Remove frequency");
} else {
curTip.add(EnumChatFormatting.GRAY + "Select a frequency");
}
}
});
addWidget(modeSelector = new WidgetMode(6, guiLeft + 10, guiTop + 57, 228, (14 * 5), 3, Refs.MODID + ":textures/gui/wirelessRedstone.png"));
modeSelector.value = gate.getMode().ordinal();
frequencyName = new GuiTextField(fontRendererObj, guiLeft + 88, guiTop + 22, 133, 10);
accessLevel.enabled = false;
saveFrequency.enabled = false;
addFrequency.enabled = false;
}
use of net.minecraft.client.gui.GuiTextField in project BluePower by Qmunity.
the class GuiCircuitDatabaseMain method initGui.
@Override
public void initGui() {
super.initGui();
WidgetTab widget = new WidgetTab(1, guiLeft - 32, guiTop + 10, 33, 35, 198, 3, Refs.MODID + ":textures/gui/circuit_database.png") {
@Override
protected void addTooltip(int curHoveredTab, List<String> curTip, boolean shiftPressed) {
switch(curHoveredTab) {
case 0:
curTip.add("gui.bluepower:circuitDatabase.tab.copyAndShare");
break;
case 1:
curTip.add("gui.bluepower:circuitDatabase.tab.private");
break;
case 2:
curTip.add("gui.bluepower:circuitDatabase.tab.server");
if (Minecraft.getMinecraft().isSingleplayer())
curTip.add("gui.bluepower:circuitDatabase.info.serverOnly");
break;
}
}
};
widget.value = circuitDatabase.clientCurrentTab;
widget.enabledTabs[2] = !Minecraft.getMinecraft().isSingleplayer();
addWidget(widget);
shareOptionTab = new WidgetSidewaysTab(2, guiLeft + 44, guiTop + 18, 14, 14, 234, 3, Refs.MODID + ":textures/gui/circuit_database.png") {
@Override
protected void addTooltip(int curHoveredTab, List<String> curTip, boolean shiftPressed) {
switch(curHoveredTab) {
case 0:
curTip.add("gui.bluepower:circuitDatabase.action.cancel");
break;
case 1:
curTip.add("gui.bluepower:circuitDatabase.action.savePrivate");
if (!enabledTabs[curHoveredTab]) {
curTip.add("gui.bluepower:circuitDatabase.info.nameTaken");
}
break;
case 2:
curTip.add("gui.bluepower:circuitDatabase.action.saveServer");
if (Minecraft.getMinecraft().isSingleplayer()) {
curTip.add("gui.bluepower:circuitDatabase.info.serverOnly");
} else if (!enabledTabs[curHoveredTab]) {
curTip.add("gui.bluepower:circuitDatabase.info.nameTaken");
}
break;
}
}
};
shareOptionTab.value = circuitDatabase.selectedShareOption;
addWidget(shareOptionTab);
copyButton = new WidgetMode(3, guiLeft + 80, guiTop + 48, 176, 37, 1, Refs.MODID + ":textures/gui/circuit_database.png") {
@Override
public void addTooltip(int x, int y, List<String> curTip, boolean shiftPressed) {
curTip.add("gui.bluepower:circuitDatabase.action.copy");
}
};
addWidget(copyButton);
Keyboard.enableRepeatEvents(true);
nameField = new GuiTextField(fontRendererObj, guiLeft + 95, guiTop + 35, 70, fontRendererObj.FONT_HEIGHT);
nameField.setEnableBackgroundDrawing(true);
nameField.setVisible(true);
nameField.setTextColor(16777215);
nameField.setText(circuitDatabase.getText(1));
}
use of net.minecraft.client.gui.GuiTextField in project BluePower by Qmunity.
the class GuiCircuitTable method initGui.
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui() {
super.initGui();
buttonList.clear();
Keyboard.enableRepeatEvents(true);
searchField = new GuiTextField(fontRendererObj, guiLeft + 8, guiTop + 20, 89, fontRendererObj.FONT_HEIGHT);
searchField.setMaxStringLength(15);
searchField.setEnableBackgroundDrawing(true);
searchField.setVisible(true);
searchField.setTextColor(16777215);
searchField.setText(circuitTable.getText(0));
}
use of net.minecraft.client.gui.GuiTextField in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class HovercraftControllerGUI method mouseClicked.
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// super.mouseClicked(mouseX,mouseY,mouseButton);
boolean prevFocused = false;
boolean postFocused = false;
for (GuiTextField text : textFields) {
prevFocused = text.isFocused() || prevFocused;
text.mouseClicked(mouseX, mouseY, mouseButton);
postFocused = text.isFocused() || postFocused;
}
if (prevFocused && !postFocused) {
updateServer();
}
}
Aggregations