File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How to get variable from JTextField() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to get variable from JTextField()" Watch "How to get variable from JTextField()" New topic

How to get variable from JTextField()

Ji Wang

Joined: Feb 28, 2002
Posts: 1
I am writing a simple application.
I have
crystalPanel.add(new JLabel("Product type"));
typeField = new JTextField(5);
I would like to have a FINISH button to end the input.
Please let me know how to add the FINISH button to end the input from multiple JTextFields.
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I'm not quite sure what you mean by end the input. If you are talking about getting the an action to happen after you hit a button then you need to read up on events. Look here.. if I'm wrong, please state it a bit clearer
or try here

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
First, someone (like me) is going to give you a hard time about not following the Naming Policy here at JavaRanch. So, you might want to re-register and change your name.
Otherwise, I'm not sure that I'm understanding you correctly. Perhaps what you want to do is JTextField.setEditable(false) to not allow any further changes to the JTextField.
At any rate, Good Luck.
-Dirk Schreckmann

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Per Dirks suggestion
Please change your displayed name to be compliant with JavaRanch's naming policy.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
[ March 01, 2002: Message edited by: Cindy Glass ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: How to get variable from JTextField()
It's not a secret anymore!