@@ -301,17 +301,8 @@ public void start(final Stage stage) {
301301 maxY = Math .max (maxY , bounds .getMaxY ());
302302 }
303303 }
304- if (minY < 0 ) {
305- // FX can't handle this
306- System .err .format ("FX can't place window at negative Y coordinate " +
307- "[x=%d, y=%d]. Please make sure that your secondary " +
308- "display does not extend above the main display." ,
309- (int ) minX , (int ) minY );
310- screenRect = primaryScreenRect ;
311- } else {
312- screenRect = new Rectangle ((int ) minX , (int ) minY ,
313- (int ) (maxX - minX ), (int ) (maxY - minY ));
314- }
304+ screenRect = new Rectangle ((int ) minX , (int ) minY ,
305+ (int ) (maxX - minX ), (int ) (maxY - minY ));
315306 }
316307
317308 // Set the displayWidth/Height variables inside PApplet, so that they're
@@ -558,10 +549,6 @@ public void placeWindow(int[] location, int[] editorLocation) {
558549 return ;
559550 }
560551
561- //Dimension window = setFrameSize();
562- // int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH);
563- // int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT);
564- // System.out.println("stage size is " + stage.getWidth() + " " + stage.getHeight());
565552 int wide = sketch .width ; // stage.getWidth() is NaN here
566553 int high = sketch .height ; // stage.getHeight()
567554
@@ -581,42 +568,10 @@ public void placeWindow(int[] location, int[] editorLocation) {
581568 stage .setY (locationY );
582569
583570 } else { // doesn't fit
584- // // if it fits inside the editor window,
585- // // offset slightly from upper lefthand corner
586- // // so that it's plunked inside the text area
587- // locationX = editorLocation[0] + 66;
588- // locationY = editorLocation[1] + 66;
589- //
590- // if ((locationX + stage.getWidth() > sketch.displayWidth - 33) ||
591- // (locationY + stage.getHeight() > sketch.displayHeight - 33)) {
592- // // otherwise center on screen
593- // locationX = (int) ((sketch.displayWidth - wide) / 2);
594- // locationY = (int) ((sketch.displayHeight - high) / 2);
595- // }
596- locationX = (sketch .displayWidth - wide ) / 2 ;
597- locationY = (sketch .displayHeight - high ) / 2 ;
598- stage .setX (locationX );
599- stage .setY (locationY );
571+ stage .centerOnScreen ();
600572 }
601573 } else { // just center on screen
602- //setFrameCentered();
603- }
604- if (stage .getY () < 0 ) {
605- // Windows actually allows you to place frames where they can't be
606- // closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508
607- //frame.setLocation(frameLoc.x, 30);
608- stage .setY (30 );
609- }
610-
611- //canvas.setBounds((contentW - sketchWidth)/2,
612- // (contentH - sketchHeight)/2,
613- // sketchWidth, sketchHeight);
614-
615- // handle frame resizing events
616- //setupFrameResizeListener();
617-
618- if (sketch .getGraphics ().displayable ()) {
619- setVisible (true );
574+ stage .centerOnScreen ();
620575 }
621576 }
622577
0 commit comments