Premiere Posted September 20, 2019 Posted September 20, 2019 I have made a textbox/textfield or whatever you want to call it but I want to be able to get the characters that were typed there, how can I do this? Quote
SerpentDagger Posted September 20, 2019 Posted September 20, 2019 Assuming that you're using the GuiTextField or a subclass, you can use GuiTextField#getText. Quote Fancy 3D Graphing Calculator mod, with many different coordinate systems. Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.
Premiere Posted September 20, 2019 Author Posted September 20, 2019 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. Quote
SerpentDagger Posted September 20, 2019 Posted September 20, 2019 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. 1 Quote Fancy 3D Graphing Calculator mod, with many different coordinate systems. Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.
Premiere Posted September 21, 2019 Author Posted September 21, 2019 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. Quote
IMleader Posted September 21, 2019 Posted September 21, 2019 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 Quote
Recommended Posts
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.