Java mouseEvent timed setText?

Associate
Joined
21 Nov 2006
Posts
716
Location
Dublin
Hi all,

I have a mouseEvent that when you hover on a label it changes the text on the label to let you know that the mouse is over the label.

Is there any way I can have the new text show for like 5 seconds and then revert back to the original text :confused:

Here's the code,I need something to replace the comment:

Code:
JLabel label2 = new JLabel("Mouse Entered Label", SwingConstants.CENTER);
.
.
.
label2.addMouseListener(this);
.
.
.


             public void mouseEntered(MouseEvent e)
             { //start of mouseEntered

                    if(e.getSource() == label2)
                    {
                    label2.setText("Mouse Enter Recieved");
                    /* revert text to original after 5 seconds */
                    }

             } //end of mouseEntered


Thanks!
 
Back
Top Bottom