類型的非法啓動它是一段代碼,引起了我的問題:的SwingWorker:
SwingWorker <Vector,void> sw=new SwingWorker <Vector,void>(){
@Override
protected Vector doInBackground() throws Exception {
TvaJpaController tjc =new TvaJpaController(emf);
Vector l_tva=null;
try{
l_tva= (Vector) tjc.findTvaEntities();
}
catch(javax.persistence.PersistenceException e)
{
javax.swing.JOptionPane.showMessageDialog(null,"please check your internet connecting");
}
return l_tva;
}
@Override
protected void done() {
Vector l_tva=null;
try {
l_tva=get();
} catch (InterruptedException ex) {
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
}
int n = l_tva.size();
for(int i=0;i<n;i++){
Tva tva =(Tva)l_tva.elementAt(i);
tva_article.addItem(tva.getIdtva());
}
}
};
sw.execute();
這一行:
SwingWorker <Vector,void> sw=new SwingWorker <Vector,void>()
給出了一個錯誤:類型的非法啓動... 我想我的問題是由於「載體」,但我不知道如何解決.. 任何幫助?
看看: http://en.wikipedia.org/wiki/SwingWorker – 2012-02-10 14:49:56
@MarwenTrabelsi:它是什麼?在我能看到的地方使用'Void'而不是'void'。 – 2012-02-10 14:50:49
外觀極好抓+1 – mKorbel 2012-02-10 14:51:59