package org.drools.games;

import javax.swing.*;
import java.awt.*;

public class GameFrame extends JFrame {
    private final Object redrawLock = new Object();

    public GameFrame() throws HeadlessException {
    }

    public GameFrame(String title) throws HeadlessException {
        super(title);
    }

    @Override
    public void paint(Graphics g) {
        // this will iterate the children, calling paintComponent
        super.paint(g);
        Toolkit.getDefaultToolkit().sync();
        resume(); // all the children are redrawn, so resume
    }

    public void waitForPaint() {
        try {
            synchronized (redrawLock) {
                repaint();
                redrawLock.wait();
            }
        } catch (InterruptedException e) {
        }
    }

    private void resume() {
        synchronized (redrawLock) {
            redrawLock.notify();
        }
    }
}

@@ -495,401 +495,62 @@
     
-    resume(); // all the children are redrawn, so resume%0A    %7D%0A%0A    public void waitForPaint() %7B%0A        try %7B%0A            synchronized (redrawLock) %7B%0A                repaint();%0A                redrawLock.wait();%0A            %7D%0A        %7D catch (InterruptedException e) %7B%0A        %7D%0A    %7D%0A%0A    private void resume() %7B%0A        synchronized (redrawLock) %7B%0A            redrawLock.notify();%0A        %7D
+%7D%0A%0A    public void waitForPaint() %7B%0A        repaint();
 %0A   

remove useless synchronization in GameFrame