aspose file tools*
The moose likes Beginning Java and the fly likes Getting a variable value in a different JForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting a variable value in a different JForm" Watch "Getting a variable value in a different JForm" New topic

Getting a variable value in a different JForm

Eder Suarez

Joined: Jun 15, 2011
Posts: 13
Hello, i'm new to the site and i have a little problem with variable values. I have a username/password JForm that compares the input data in my textFields with my MySQL database. The thing is that my string (lets name it someString) gets the value from my textField when a button is pressed, but i can't return any value as actionPerformed is void type. If i declare it as an instance variable and use in my JForm2 as:

JForm1 jform=new JForm();
String temp=jform.someString;

i get the initial value, not the gathered from the textField.

I've tried with a method outside actionPerformed, but the result is the same. Any ideas?
Paul Clapham

Joined: Oct 14, 2005
Posts: 18110

I don't know what a JForm is, but in your example there isn't any process which involves the user keying data into a text field, at least not that I can see, so it isn't surprising that you get the initial value of the JForm's variable.
I agree. Here's the link:
subject: Getting a variable value in a different JForm
Similar Threads
Data from JForm to databse
getting information from GUI
Update/Set TextField from other class
Connecting Jtable from main frame to Jform.
null value to database table from JForm