This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To make Button Display in JTextarea

 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i get a something to display in the JTextArea?

Here is an example of my code




Now everytime I hit south, How do i get something to display in the TextArea?
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,
Use the setText method to insert the text you wanted to display.
Was this what you wanted?
- Sai
 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Something like that right?

Well yeah I tried that and I get::


This happens when I use the Append method too.
JTextArea is imported, and is global
[ December 08, 2004: Message edited by: Sean Magee ]
 
sasi kala
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sean,

setText is not a variable its a method,

To setText use text.setText("...");
To append to use text.append("...");

All The Best.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic