PROBLEMAS COM CONTROLE CUSTOMIZADO (Thread)

Galera estou terminando ums componentes utilitarios, como vcs ja devem ter visto eu adoro desenvolver coisas novas :smiley: bom estou desenvolvendo um StatusBar inteligente e algumas sub-classses desse, bom vamos a minha pergunta eu criei ums Novos Tipos de Labels chamados JLabelDate, JLabelTime, JLabelCapsLock e JLabelNumLock este labels mostram respectivamente Data, Hora, Estatus de Capslock e NumLock e servem como subobjetos dentro do StatusBar. bom o problema e o seguinte ele possuem um Thread interno que fica atualizando o Label mais quando inicio minha aplicação o thread do Label Trava toda minha aplicação, ja dei minimo priory nele mais nao da ajudem-me ai galera :lol:

package util;

import java.util.*;
import java.text.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JLabelDate extends JLabel implements Runnable {
  
    private int Formato = 0;
    private Thread Run;
    
    private void PaintDate() {
        this.setText(DateFormat.getDateInstance(Formato,Locale.getDefault()).format(new Date()));
    }
    
    public JLabelDate(int Formato) {
      super();
      this.Formato = Formato;      
      Run = new Thread(this);
      Run.setPriority(Run.MIN_PRIORITY);
      Run.run();
    }
   
    /** When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see     java.lang.Thread#run()
     *
     */    

    public void run() {
      while(true) {
        try{
             PaintDate();
             Run.sleep(1000);        
         }catch(InterruptedException e){}    
       }
    
    }
}

AnjoMal e seu StatusBar… :smiley:

Não deveria ser:

    public JLabelDate(int Formato) { 
      super(); 
      this.Formato = Formato;      
      Run = new Thread(this); 
      Run.setPriority(Run.MIN_PRIORITY); 
      Run.start(); 
    } 

Pra iniciar a Thread num é start() ??

PUTZ !!! QUE MOLE !!!

ESCREVI O CODIGO NEM VI A MANOTA !!!

:lol:

Valew Cara !!!

se voce quiser diminuir a prioridade delas mais ainda, seta elas como Daemon.

outra coisa, use letras minusculas para nomes de referencias (run e nao Run)

Falando nisso como eu fasso para saber se a tecla CAPSLOCK e NUMLOCK estao pressionadas ?

Anjomal, por favor evite escrever SEMPRE EM MAISCULAS.

Rafael

Blz …

Foi Mal :cry:
:roll: