Can't override process() method in SwingWorker Can't override process() method in SwingWorker multithreading multithreading

Can't override process() method in SwingWorker


The SwingWorker class is defined as follows:

public class SwingWorker<T, V> {    ...    protected void process(List<V> chunks) {        ...    }}

So, since your subclass is declared as

class RemotePlayersWorker extends SwingWorker<String[][], Object> {

The process method should take a List<Object> as argument, and not a List<String[][]>


You have incorrect parameter in your process() method it should be

protected void process(List<Object> chunks) {   /// do your stuff}

It takes 2nd. generic datatype of SwingWorker class. Please read documentation.

Explanation:

public class SwingWorker<T, V> {    // methods    protected void process(List<V> chunks) {       // do your stuff    }}

Here you can see more purely that process() method takes V that is in your case Object.

So either change it to List<Object> or reverse your signature of SwingWorker class(but then you need to change return type of doInBackground() method).


Your siganture for the process method is wrong.

The signature from SwingWorker : protected void process(List<V> chunks)

V - the type used for carrying out intermediate results by this SwingWorker's publish and process methods

So it should be :

protected  void process(List<Object> chunks)