Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Help with JText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help with JText" Watch "Help with JText" New topic

Help with JText

Chris Swanson

Joined: Nov 30, 2009
Posts: 15
Hello. I am trying to create a question/answer form using JTextAreas. However, I have a bug where three JTextAreas appear. Also, I could not find a way to simply replace the text in a JTextField, so I created a new JTextArea and removed the old one. What am I doing wrong in my code?

pete stein

Joined: Feb 23, 2007
Posts: 1561
Your code doesn't compile mainly because your class name "Card" doesn't match the constructor name, "LearningCard". This may be a simple oversight by you, but makes our figuring out what's wrong a bit more difficult.

I am also curious why you are adding and removing text components such as JTextAreas rather than just changing the contents of JTextAreas that remain.

Also, where is the code that reproduces your program's "bug"? I suggest that you consider creating and posting a Short, Self Contained, Correct (Compilable), Example or SSCCE that illustrates your problem (please see the link).

Much luck!
pete stein

Joined: Feb 23, 2007
Posts: 1561
For instance,

I agree. Here's the link:
subject: Help with JText
It's not a secret anymore!