Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display something on JPanel in turn  RSS feed

 
Forman Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code achieve that when i click the different button, different string will display on panel.
Here is the problem:
1,for now,when i click the next button,last displayed string will disappear,how to make all strings remain? Just like add one line of string each time when i click the button, but not replace the last string.
2,I use flag to control the display, is there any other better ways to chieve but not use flag?

 
Rob Camick
Ranch Hand
Posts: 2753
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't do custom painting.

Instead add a JTextArea to the frame. Then you can use the append(...) method to add more text to the text area.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!