This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring 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: 19853

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

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: getText() is not working?
It's not a secret anymore!