Salut tout le monde

Je veux faire clignoter un jLabel sous netBeans. J'ai essayé le code suivat:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
public class Interface1 extends javax.swing.JFrame {
 
    /** Creates new form Interface1 */
    public Interface1() {
        initComponents(); 
 
        JLabel   lab = new logiciel.BlinkingLabel("GestOp", Color.CYAN);
 
    }
La classe BlinkingLabel se trouve dans un package nommé " logiciel" :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
 
package logiciel;
 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 
 
public class BlinkingLabel extends JLabel
{  
  Color defaultColor;   // Couleur par defaut du label
  Color blinkingColor;  // Couleur de clignotement
  Timer timer;          // Timer declenchant des tics
 
  public BlinkingLabel (String text,  Color  blinkingColor) 
  {	
    super (text);    
    this.blinkingColor = blinkingColor;
    this.defaultColor  = getForeground ();
 
    // Creation et lancement du timer
    timer = createTimer ();
    timer.start ();
  }
 
  // Methode renvoyant un timer pret a demarrer
  private Timer createTimer ()
  {
    // Creation d'une instance de listener associee au timer
    ActionListener action = new ActionListener ()
      {
        // Methode appelee a chaque tic du timer
        public void actionPerformed (ActionEvent event)
        {
          // Inversion de la couleur
          if (getForeground ().equals (defaultColor))            
            setForeground (blinkingColor);
          else
            setForeground (defaultColor);
        }
      };
 
    // Creation d'un timer qui genere un tic
    // chaque 500 millieme de seconde
    return new Timer (500, action);
  }
Ça ne marche pas . please help