0

Hi
i'm trying to make a JFrame with 4 jlabels. So far no problems, but i want it to show the first only. 4 seconds later the second, and so on...

I know how to make the labels invisible and vasiable again, i just don't know about the time delay.

When searching the net a came across Thread.sleep();
But that showed my entire jframe after it went through all the sleep times, and didn't make the lables one by one visible.:sad:

Do you guys have any advice you can give me?

3
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by IDSA
0

Thanks for your answer. It helped me for some other stuff i'm doing. But not for the labels thingy. The problem is when doing this

TimerTask task = new TimerTask ()  
        {  
               public void run ()  {  
                       Jlabel lblHallo = new JLabel();

i can't use

getContentPane().add(lblHallo);

it won't add th label to my jframe
it works when not using TimerTask, but not within the RUN methode.
and yes i have this

Timer timer = new Timer () ; 
           timer.schedule ( task, 5000 ) ;//do after 5 sec

in my code

0

sorry how did u managed to solve the problem, i have same problem with images would u mind telling me. thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.