Lagging problem - pmdacosta/notes GitHub Wiki

Pro tip: put Toolkit.getDefaultToolkit().sync(); at starting of the GamePanel::paintComponent function, so the buffer is being synchronized every frame (note that when using canvas, Toolkit.getDefaultToolkit().sync() is being ran automatycally);

If someone wonders, it fixes the "lagging" issue.

-- Comment by @floppey4399 at Game Loop and Key Input - How to Make a 2D Game in Java #2 video by RyiSnow