@@ -65,9 +65,9 @@ public Canvas initCanvas(PApplet sketch) {
6565 public Frame initFrame (PApplet sketch , Color backgroundColor ,
6666 int deviceIndex , boolean fullScreen , boolean spanDisplays ) {
6767 this .sketch = sketch ;
68-
69- sketchWidth = sketch .sketchWidth ();
70- sketchHeight = sketch .sketchHeight ();
68+
69+ sketchWidth = sketch .width = sketch . sketchWidth ();
70+ sketchHeight = sketch .height = sketch . sketchHeight ();
7171
7272 frame = new DummyFrame ();
7373 return frame ;
@@ -173,9 +173,13 @@ public boolean isStopped() {
173173
174174 @ Override
175175 public void setSize (int width , int height ) {
176- // TODO Auto-generated method stub
177-
176+ if (frame != null ) {
177+ sketchWidth = sketch .width = width ;
178+ sketchHeight = sketch .height = height ;
179+ graphics .setSize (width , height );
180+ }
178181 }
182+
179183
180184 @ Override
181185 public void setSmooth (int level ) {
@@ -263,11 +267,11 @@ public void run() { // not good to make this synchronized, locks things up
263267
264268 // If size un-initialized, might be a Canvas. Call setSize() here since
265269 // we now have a parent object that this Canvas can use as a peer.
266- if (graphics .image == null ) {
270+ // if (graphics.image == null) {
267271// System.out.format("it's null, sketchW/H already set to %d %d%n", sketchWidth, sketchHeight);
268- setSize (sketchWidth , sketchHeight );
272+ setSize (sketchWidth , sketchHeight );
269273// System.out.format(" but now, sketchW/H changed to %d %d%n", sketchWidth, sketchHeight);
270- }
274+ // }
271275
272276 // un-pause the sketch and get rolling
273277 sketch .start ();
0 commit comments