serabile serabile - 1 year ago 97
Java Question

how to use timer with SwingWorker

need an example, how to use timer in SwingWorker ? because it impossible to add an ActionListener to my Timer like that !

private Timer timer = new Timer(100, new ActionListener() {

public void actionPerformed(ActionEvent ae) {


Message Error : The constructor Timer(int, new ActionListener(){}) is undefined

Answer Source

There is nothing wrong in your source, looks like you are importing different Timer class. Are your using javax.swing.Timer. Refer the API document here.

May be you had imported or java.util.Timer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download