This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

TextField Population of Mouse Events?  RSS feed

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HOW DO I POPULATE THE TextField txt WITH THE String msg, WHICH IS DEFINED FOR EACH EVENT
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Farid!
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!