Java Swing UIManger causes slowness -
i experienced weird issue in real time stock prices gui java application. problem code:
inputmap im = (inputmap)uimanager.get("button.focusinputmap"); im.put(keystroke.getkeystroke("pressed space"), "none"); im.put(keystroke.getkeystroke("released space"), "none");
if call main thread whole gui application becomes slow, lagging when scrolling table up/down. fix seems to call code swing thread.
what going on when wrong thread calls it?
the fix seems to call code swing thread.
actually fix call processing logic separate thread, not event dispatch thread (edt)
. edt swing thread responsible responding events , painting gui, should not execute long running code or gui becomes unresponsive.
read section swing tutorial on concurrency more information. can use swingworker
execute long running code.
Comments
Post a Comment