• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Problem

 
Johny Trinh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've just taken my mid-term exam.
And I got my problems here

I had code for a very simple GUI display the text, and after 1 second, it display the text which is split the first character:



Copy and run this code you will see the problems.
After the last character appear, in the second time, the whole text disappear forever.
I didn't know where I get lost.

Can somebody help me with this?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you creating new JLabel objects all the time? Just create one instance, and then call the "setText" method of it repeatedly.
 
Johny Trinh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried it already! It runs successfully! But in the exam i didn't know the setText() method.
Anyway,
I want to understand how thread run each time and where I got lost with this method!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!