Salve tutti.Ho creato due thread.
Uno,t2, per creare una finestra di tipo JDialog in cui aggiungo un JPanel in cui a sua volta è aggiunto una JLabel.
Ecco il codice della finestra :
Classe PanelProgres
codice:
public class PanelProgres extends JDialog implements IWindow{
       private JPanel panelProgresBar;
   public PanelProgres(JFrame frame){
       super(frame,"Progres bar",true);
       this.setResizable(false);       
       this.setBounds(450, 300, 400, 100);       
       this.panelProgresBar = new JPanel();
       SwingUtilities.invokeLater(new Runnable(){

            public void run() {
                panelProgresBar.add(new JLabel("Wait please.....application is working progres"));
            }
       
       });
       
       this.getContentPane().setLayout(new BorderLayout());       
       this.getContentPane().add(BorderLayout.CENTER,panelProgresBar); 
       
                
       
       
       
      
  }
    
    

    public void showWindow() {
        this.setVisible(true);
    }

    public void closeWindow() {
        this.dispose();
    }
Ed un thread,t1, che esegue un'altra operazione.Tutti e due i thread vengono creati un actionPerformed :

codice:
 if(e.getActionCommand().equals("Create corpus")){
          System.out.println("Create corpus"); 
          String splitLinea[] = ((FormCorpusTIMIT)iform).getIstant();          
          if(((FormCorpusTIMIT)iform).getDirectory().isEmpty()){
              this.showWindow(iwindow = new WindowMsg((JFrame)GraphicInterfaceAgSpit.getInstance(this),this,"Attention","The field directory is empty"));
          }else if(splitLinea[0].isEmpty()){
                this.showWindow(iwindow = new WindowMsg((JFrame)GraphicInterfaceAgSpit.getInstance(this),this,"Attention","The field istant is empty"));
              
          }else{
                SaveFileXML sfXML = new SaveFileXML(GraphicInterfaceAgSpit.getInstance(this),new TestDirectory("Corpus").getDir());           
                ProgresBar pb = null;
                final PanelProgres pp = null; 
                AgSetTIMIT agT = ((AgSetTIMIT)agSet);          
               
                final GraphicInterfaceAgSpit gia = GraphicInterfaceAgSpit.getInstance(this);
                Thread t2 = new Thread(new Runnable(){

                    public void run() {
                        showWindow(new PanelProgres(gia));
                    }
                    
                });
               
                
               
                Thread t1 = new Thread(agT = new AgSetTIMIT(iform,sfXML.getNameFile()));
                            
               
                
                t1.start();
                t2.start(); 
                try {

                  
                    t1.join();
                    this.showWindow(iwindow = new WindowMsg((JFrame)GraphicInterfaceAgSpit.getInstance(this),this,"","Done"));
                } catch (InterruptedException ex) {
                    Logger.getLogger(ControllerAgSpit.class.getName()).log(Level.SEVERE, null, ex);
                }
                   
                   
                   
               

              
          } 
          
       }
Inoltre come si vede dal codice eseguo un join sul thread t1 per farsi che alla sua esecuzione mi compaia una JDialog per indicare che il processo relativo all'operazione è terminato.
Ora il problema è :
1)Aggiornamento del PanelProgres nel senso di inserimento della Jlabel nella JDialog avviene solo quando compare la finestra per indicare che l'operazione è terminata,quindi avviene insieme alla finestra per indicare che l'operazione è terminato.
Sto cercando in tutti i modi di risolvere ma non vi riesco.
Spero di essere stato chiaro.Dove sbalgio??