Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript 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: 2787
12
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!