Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get text from Jtextfield and transfer it between classes.  RSS feed

 
Peter And
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys. New to the forums so if Im violating any rules please tell me.
So Im writing a program that records the score in a dart game. One component of the program is a stage where players enter their name.
This information needs to be displayed in another part of the program. These two components are in two different classes. My problem is I dont know how to get that information from one class to another.
Unfortunately my code is not available to me right now. I will answer any questions I can. The code will be posted tomorrow.

Im using Jtextfield in Jframe to record the information.

Any suggestions are very much appreciated.
 
Campbell Ritchie
Sheriff
Posts: 53769
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
You get the text from a text box same way you get the contents of a field from anything else.It would be a good idea to put some validation of the text between lines 3 and 5, otherwise you have no way of knowing whether the entry in the box is suitable for use.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!