ActionListener のボタンがあり、SwingWorker で CopyTask メソッドを呼び出そうとしましたが、Eclipse で「メソッド CopyTask(File, File) は ActionListener(){} 型に対して未定義です」というエラーが表示されます。助けてくれませんか
//imported everything needed
public class A extends JFrame implements PropertyChangeListener
{
File src;
File dest;
CopyTask task;
//other components
JTextFiles jt = new JTextField();
src = new File(jt.getText()); //getting input from JTextField
dest = new File ("\\C$\\Web"); //providing the location manually
CopyTask task = this.new CopyTask(src, dest);
task.addPropertyChangeListener(this);
task.execute();
@Override
public void propertyChange(PropertyChangeEvent evt)
{
if("progress".equals(evt.getPropertyName()))
{
int progress = (Integer) evt.getNewValue();
progressAll.setValue(progress);
}
}
class CopyTask extends SwingWorker<Void, Integer>
{
private File source;
private File target;
private long totalBytes = 0;
private long copiedBytes = 0;
public CopyTask(File src, File dest)
{
this.source = src;
this.target = dest;
progressAll.setValue(0);
// progressCurrent.setValue(0);
}
@Override
public Void doInBackground() throws Exception
{
ta.append("Retrieving some info ... ");
retrieveTotalBytes(source);
ta.append("Done!\n");
copyFiles(source, target);
return null;
}