aspose file tools*
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 Soft Skills 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
Author

How to get variable from JTextField()

Ji Wang
Greenhorn

Joined: Feb 28, 2002
Posts: 1
Hi:
I am writing a simple application.
I have
crystalPanel.add(new JLabel("Product type"));
typeField = new JTextField(5);
crystalPanel.add(typeField);
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.
Thanks.
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
http://developer.java.sun.com/developer/Books/swing/
or try here
http://java.sun.com/docs/books/tutorial/uiswing/events/
-Regards
Dale


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

Joined: Dec 10, 2001
Posts: 7023
Hello,
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"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Per Dirks suggestion
jiwang,
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: http://aspose.com/file-tools
 
subject: How to get variable from JTextField()