我有一个 SwingWorker 类,如下所示:
class RemotePlayersWorker extends SwingWorker<String[][], Object> {
PlayerCanvas parent;
RemoteHandler remote;
String[][] players;
int maximumConnections;
public RemotePlayersWorker(PlayerCanvas parentCanvas, RemoteHandler remoteHandle) {
this.parent = parentCanvas;
this.remote = remoteHandle;
}
@Override
protected String[][] doInBackground() throws Exception {
System.out.println("TEST 1");
players = remote.getConnectedPlayers();
publish(players);
return players;
}
@Override
protected void process(List<String[][]> chunks) {
for (String[][] chunk : chunks) {
// no need for the c variable
System.out.println(chunk.toString());
}
}
@Override
protected void done() {
}
}
但是,在覆盖 process(List chunks) 方法时出现错误。Eclipse 告诉我这个:
The method process(List) of type PlayerHandler.RemotePlayersWorker must override or implement a supertype method
但是,据我所知,我正确地覆盖了该方法 - 无论我将列表类型设置为什么,我都会收到相同的错误。
还有其他原因我无法覆盖 process() 吗?
我正在使用 Java 版本“1.7.0_10”-Java(TM) SE 运行时环境(构建 1.7.0_10-b18)