File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Save a text field as a variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Save a text field as a variable" Watch "Save a text field as a variable" New topic

Save a text field as a variable

James Palmer
Ranch Hand

Joined: Mar 15, 2004
Posts: 36
Hello,basically am doing an assignment for university and there's one thing i don't seem to find a solution to.I have made a GUI and i want something that i have written as an input in a text field to be saved as a string.How can i do this?Replies are very appreciated.
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Check out the API for JTextComponent here.
Specifically, getText().
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / JFC / AWT forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Save a text field as a variable
It's not a secret anymore!