Results 1 to 4 of 4
Thread: Register content of jTextField
- 11-19-2010, 09:32 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 33
- Rep Power
- 0
Register content of jTextField
Hi
Is there a way of registering what is written in a jTextfield and then displaying a message on jLabel. I tried the following
created a boolean
Java Code:boolean bool1 = false;
Java Code:if(jTextField.getText()="1"&& jTextField1.getText()="1"&& jTextField2.getText()="1") return bool1 = true if(bool1=true) { jLabel.setText("Victory"); }
Any ideas would be appreciated
-
It's hard to understand what you mean by "registering"? Are you trying to check JTextField contents on JButton click? If so, then get the content's in the button's action listener. If my advice doesn't help you, you may wish to post an SSCCE to better illustrate your problem.
- 11-19-2010, 09:48 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 33
- Rep Power
- 0
Ok to put it short
There are no buttons, just textfields. If 3 textfields contain a String = "X" there is a simple String displayed on a jLabel "WON"
-
If you want to follow changes to JTextFields without use of a JButton (and I recommend that you use a button by the way), you can always listen for document changes by using a DocumentListener on the three JTextField's documents. The tutorials will explain how to do this.
Similar Threads
-
Adding jTextField() content to the database?
By Stephen Douglas in forum New To JavaReplies: 12Last Post: 04-08-2010, 10:50 AM -
Oracle connection and register
By digioleg in forum New To JavaReplies: 1Last Post: 08-19-2009, 08:43 PM -
how to access jTextField of one JFrame1 from JFrame2 & Modify JTextField contents
By sumit1mca in forum AWT / SwingReplies: 1Last Post: 01-30-2009, 07:44 PM -
can't register a MySQL driver
By prfalco in forum New To JavaReplies: 4Last Post: 02-04-2008, 12:13 AM -
Clean the content of the JTextField
By elizabeth in forum AWT / SwingReplies: 1Last Post: 07-26-2007, 09:38 PM
Bookmarks