2013-03-06 30 views
0

我寫了一個擴展SwingWorker的類。我寫了被覆蓋的功能:doInBackground,完成,過程中,但由於某種原因,我得到的編譯錯誤:我在Swing Worker中遇到了一個編譯錯誤?

The method process(List) of type BillImportAnalyzerGUI.Task must override or implement a supertype method

這裏是我的類:

private class Task extends SwingWorker<Void, Void> 
    { 
    @Override 
    public Void doInBackground() 
    { 
     try 
     { 
     generateReport(BillImportId.getText()); 
     } 
     catch (InterruptedException e) 
     { 
     } 
     catch (Exception e) 
     { 
     } 

     publish(); 

     return null; 
    } 

    @Override 
    protected void done() 
    { 
     try 
     { 
     jLabel6.setText("Generated Report"); 
     } 
     catch (Exception ignore) 
     { 
     } 
    } 

    @Override 
    protected void process(List<String> chunks) 
    { 
     jLabel6.setText("Generating Report"); 
     jProgressBar1.setVisible(true); 
    } 
    } 

回答

3

的問題是,你正在擴大SwingWorker<Void,Void>但是您聲明的方法爲process(List<String> chunks)

在這種情況下,您應該延伸SwingWorker<Void,String>

+0

令人驚歎!問題解決了!非常感謝! – Wael 2013-03-06 11:07:18

相關問題