Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with JText

 
Chris Swanson
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For instance,


and
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic