Jump to content

Can't type in gui text field!


AskHow1248

Recommended Posts

I have a gui with a text field, but I can't sellect it to type in it.  I can make it sellected when you open the gui, but I can't sellect it in the gui.

 

Gui:

 

 

package Technomage3.both.Interfaces.guis;

import java.util.ArrayList;

import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

import am2.api.spell.component.interfaces.ISpellPart;
import am2.api.spell.component.interfaces.ISpellShape;
import am2.containers.ContainerInscriptionTable;
import Technomage3.both.Interfaces.containers.ContainerItemTransferNetworkBase;
import Technomage3.both.ItemTransfer.tileentities.TileEntityItemTransferNetworkBase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;

public class GuiItemTransferNetworkBase extends GuiContainer {

private static final ResourceLocation tex = new ResourceLocation("tn3", "textures/gui/itemTransfer/base.png");

private GuiTextField name;
private ContainerItemTransferNetworkBase cont;

public GuiItemTransferNetworkBase(TileEntityItemTransferNetworkBase tile, EntityPlayer player) {
	super(new ContainerItemTransferNetworkBase(tile, player));
	xSize = 176;
	ySize = 130;
	cont = (ContainerItemTransferNetworkBase) super.inventorySlots;
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {

	GL11.glColor4f(1, 1, 1, 1);

	super.mc.renderEngine.bindTexture(tex);

	drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);

}

public void initGui(){
	super.initGui();

	name = new GuiTextField(this.fontRenderer, 50, 19, 72, 12);
	name.setText(cont.name);
	name.setFocused(true);

}

protected void drawGuiContainerForegroundLayer(int par1, int par2)
    {
        name.drawTextBox();
    }

protected void keyTyped(char par1, int par2)
{
	if (this.name.textboxKeyTyped(par1, par2))
	{
		cont.setName(name.getText());
	}
	else
	{
		super.keyTyped(par1, par2);
	}
}
protected void mouseClicked(int par1, int par2, int par3)
    {
        super.mouseClicked(par1, par2, par3);
        this.name.mouseClicked(par1, par2, par3);
    }

public void updateScreen()
    {
        this.name.updateCursorCounter();
    }

    
}

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.