File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Field text not returning

 
Maja Gralewska
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm trying to get a value from a text field after it has been edited but when ever i run the code it returns blank even if there is text edited it there. The first time you log in there is a default value but it can be edited.




Any ideas on why it doesn't return a value would be greatly appreciated.
Thanks

(Jesper Young: Fixed code tags)
 
Campbell Ritchie
Sheriff
Pie
Posts: 47231
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do void methods ever return a value? And please use the CODE button rather than writing tags by hand.
 
Maja Gralewska
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand, i don't want to send the value to another method or anything like that i just want to print the value that the user inserts?

thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 47231
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that is what "return" means.

If you want to print it out, it is worth checking whether the if condition is ever satisfied.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
possibly you have agentCodeF declared twice:
once as a class field - the one referenced by the listener
also as a local variable, local to the constructor (or whatever method you build the gui) - this is the one you see on the screen

remove the duplication, and agentCodeF.getText() should return it's value
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic