protected GuiLabel createLabel(String title, int id, int x, int y, int width, int height) { GuiLabel label = new GuiLabel(gui.mc.fontRendererObj, id, x, y, width, height, 0xFFFFFFFF); label.addLine(title); label.setCentered(); return label; }
public void drawLabels(int mouseX, int mouseY) { // Labels for (GuiButton aButtonList : this.buttonList) aButtonList.drawButton(this.mc, mouseX, mouseY, 0); // Buttons for (GuiLabel aLabelList : this.labelList) aLabelList.drawLabel(this.mc, mouseX, mouseY); } }
public void redrawLabels() { // Clear existing labels for nutrition value or screen changes labelList.clear(); // Draw title String nutritionTitle = I18n.format("gui." + Nutrition.MODID + ":nutrition_title"); labelList.add(label = new GuiLabel(fontRenderer, 0, (width / 2) - (fontRenderer.getStringWidth(nutritionTitle) / 2), top + TITLE_VERTICAL_OFFSET, 0, 0, 0xffffffff)); label.addLine(nutritionTitle); // Nutrients names and values int i = 0; for (Nutrient nutrient : NutrientList.getVisible()) { // Create labels for each nutrient type name labelList.add(label = new GuiLabel(fontRenderer, 0, left + LABEL_NAME_HORIZONTAL_OFFSET, top + LABEL_VERTICAL_OFFSET + (i * NUTRITION_DISTANCE), 0, 0, 0xffffffff)); label.addLine(I18n.format("nutrient." + Nutrition.MODID + ":" + nutrient.name)); // Add name from localization file // Create percent value labels for each nutrient value labelList.add(label = new GuiLabel(fontRenderer, 0, left + LABEL_VALUE_HORIZONTAL_OFFSET + labelCharacterPadding, top + LABEL_VERTICAL_OFFSET + (i * NUTRITION_DISTANCE), 0, 0, 0xffffffff)); if (ClientProxy.localNutrition != null && ClientProxy.localNutrition.get(nutrient) != null) // Ensure local nutrition data exists label.addLine(Math.round(ClientProxy.localNutrition.get(nutrient)) + "%%"); else label.addLine(I18n.format("gui." + Nutrition.MODID + ":updating")); i++; } }
id++; GuiLabel label = new GuiLabel(Minecraft.getMinecraft().fontRenderer, id++, 110, y, 230, 20, 0xffffffff); label.addLine(profile.getDescription()); this.labelList.add(label); y += 22; GuiLabel label = new GuiLabel(Minecraft.getMinecraft().fontRenderer, id++, 20, y, 340, 20, 0xffffffff); label.addLine("(note, you can create your own profiles and many more"); label.addLine("configuration options in 'lostcities.cfg')"); this.labelList.add(label);
@Override public void drawScreen(int par1, int par2, float par3) { // super.drawScreen(par1, par2, par3); // drawBackground(par1); drawGuiContainerBackgroundLayer(par3, par1, par2); for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton) this.buttonList.get(i)).drawButton(this.mc, par1, par2, par3); } for (int j = 0; j < this.labelList.size(); ++j) { this.labelList.get(j).drawLabel(this.mc, par1, par2); } for (GuiTextField text : textFields) { text.drawTextBox(); } }
@Override public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); mc.getTextureManager().bindTexture(BACKGROUND); int textureWidth = 239; int textureHeight = 232; drawTexturedModalRect((width - textureWidth) / 2, (height - textureHeight) / 2, 7, 7, textureWidth, textureHeight); for (int j = 0; j < this.labelList.size(); ++j) { this.labelList.get(j).drawLabel(this.mc, par1, par2); } for (GuiTextField text : textFields) { text.drawTextBox(); } }