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?
posted 1 year ago
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.