File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes TextField Population of Mouse Events? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "TextField Population of Mouse Events?" Watch "TextField Population of Mouse Events?" New topic
Author

TextField Population of Mouse Events?

Vivek Nambiar
Ranch Hand

Joined: Sep 25, 2000
Posts: 63
HOW DO I POPULATE THE TextField txt WITH THE String msg, WHICH IS DEFINED FOR EACH EVENT
ali farid
Ranch Hand

Joined: Aug 26, 2000
Posts: 60
Hi
There are 3 modifications needed in your code.
1.TextField txt = new TextField(); should appear outside the constructor.
2.setVisible(true); should appear after add(txt, BorderLayout.SOUTH);
3.Add this line to your paint() method.
txt.setText(msg);
After these modifications the code is running fine on my machine.
Vivek Nambiar
Ranch Hand

Joined: Sep 25, 2000
Posts: 63
Thanks a lot Farid!
Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Dear Vivek
define a new method, something like
public void setText(String msg)
{
txt.setText(msg);
}
call this method from inside every listener method. Of course, you'll have to define the TextField object txt as a instance member, i.e., outside the constructor.
Regards
Sanjeev
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TextField Population of Mouse Events?