File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "getText() is not working?" Watch "getText() is not working?" New topic

getText() is not working?

munjal upadhyay
Ranch Hand

Joined: Sep 18, 2010
Posts: 69

the problem is written in the comments

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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 ....

I agree. Here's the link:
subject: getText() is not working?
It's not a secret anymore!