Fixed a bug (the repaint thread called Toolkit.sync()).