This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes getText() is not working? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "getText() is not working?" Watch "getText() is not working?" New topic
Author

getText() is not working?

munjal upadhyay
Ranch Hand

Joined: Sep 18, 2010
Posts: 69

the problem is written in the comments




Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, that code is working correctly.

In your actionPerformed method you create a new Desine object. Naturally all of its instance variables are created and initialized as per lines 7 to 35 of your posted code. In particular the JTextFields are empty. So when you access the contents of one of those JTextFields you get an empty string.

I assume you are surprised that you don't get the data from the JTextField from the original Desine object, the one which would be referred to as "this" in the actionPerformed method. You shouldn't be surprised, because you didn't ask for the data from that object.
munjal upadhyay
Ranch Hand

Joined: Sep 18, 2010
Posts: 69

I got it ....

thanks...
 
Consider Paul's rocket mass heater.
 
subject: getText() is not working?
 
Similar Threads
Getting a problem while using database connectivity
Getting sql error [Microsoft ][odbc microsoft access driver]numeric index out of range
Can't Update Record ?
Adding Record Problem in JDBC ?
Can't Update Record ?