Rewrites the addCanvasToJFrame function, so that it deals with the first draw calls.
@@ -111,10 +111,17 @@ public class Screen {
* Adds the screen's canvas to a JFrame and sets the frame to
* visible.
*
+ * Also performs the first draw of the canvas.
+ *
* @return
* A JFrame with the canvas on it.
+ *
+ * @throws InterruptedException
+ * If any thread has interrupted the current thread. The
+ * <i>interrupted status</i> of the current thread is
+ * cleared when this exception is thrown.
*/
- public JFrame addCanvasToJFrame() {
+ public JFrame addCanvasToJFrame() throws InterruptedException {
final JFrame frame = new JFrame();
frame.add(canvas);
frame.setResizable(false);
@@ -123,6 +130,10 @@ public class Screen {
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setVisible(true);
+ draw();
+ Thread.sleep(500);
+ draw();
+
return frame;
}
