On my JApplet I have one JTextArea. I also have variable counter. I would like to display different text on JTextArea for different values of variable counter.
For example, if counter is 5, to display "You are on 5th assignment".
I have written code for that, but my JAplet does not repaint. How to set that?
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted
0
That's impossible to say without seeing the code.
maja neskovic
Ranch Hand
Joined: Apr 28, 2010
Posts: 134
posted
0
Here is the code:
It works this way, I think I made it.
Greetings!
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted
0
Glad to hear you got it to work. Note that instead of "TestAplet.this.repaint()" you can just write "repaint()".
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1644
posted
0
You don't even need the repaint() method.
Swing components are smart enough to repaint themselves automatically when the value of a property (like setText) is changed.