2013-03-06 42 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

相关问题