Jump to content

How can I get the characters typed in a TextBox/TextField?


Recommended Posts

Posted

Assuming that you're using the GuiTextField or a subclass, you can use GuiTextField#getText.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted
29 minutes ago, SerpentDagger said:

Assuming that you're using the GuiTextField or a subclass, you can use GuiTextField#getText.

How do I do that? Like for example, will I do like "public void GuiTextField#getText" (Just to come up with one, but it obviously won't be void)? To be honest I am not that good with Java but I know some things I guess.

Posted

getText() is already a method in all instances of GuiTextField, so you don't need to make a new one for it. Just call the method on your GuiTextField object, and it will return the text contained by said object.

As a side note, I'd suggest you get much more familiar with Java in general before trying to do anything complicated with Forge, as it's not very beginner-friendly in places.

  • Thanks 1

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted

I haven't done really anything in terms of creating Guis in Minecraft/Forge so that is why I don't really know, because when I make something in Forge it is basically the same topic so my learning doesn't really go anywhere but today I thought I would give making a Gui a shot.

Posted
13 hours ago, Premiere said:

I haven't done really anything in terms of creating Guis in Minecraft/Forge so that is why I don't really know, because when I make something in Forge it is basically the same topic so my learning doesn't really go anywhere but today I thought I would give making a Gui a shot.

Check out, my GUI class. When the class is initialized, I set class level variables to each part of my gui that I needed. That way, when the buttons are clicked(or any event really) I can test aginst my objects. Same applies to you, onAction -> getText 

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.