I have an application that I\'m building in Swing. It has a scrollable and zoomable chart component which I can pan and zoom in. The whole thing is smooth except that sometime
Take a look at this question. It describes a simple log on the EDT.
Create a class like this:
public class TimedEventQueue extends EventQueue {
@Override
protected void dispatchEvent(AWTEvent event) {
long startNano = System.nanoTime();
super.dispatchEvent(event);
long endNano = System.nanoTime();
if (endNano - startNano > 50000000)
System.out.println(((endNano - startNano) / 1000000)+"ms: "+event);
}
}
Then replace the default EventQueue with the custom class:
Toolkit.getDefaultToolkit().getSystemEventQueue().push(new TimedEventQueue());