ignore Insets, not needed with JFrame like the are with awt.Frame

This commit is contained in:
Ben Fry
2013-07-24 10:52:54 -04:00
parent 0db32af8c4
commit 3fc5a78825
+12 -8
View File
@@ -10596,12 +10596,13 @@ public class PApplet extends Applet
// can't do pack earlier cuz present mode don't like it
// (can't go full screen with a frame after calling pack)
// frame.pack(); // get insets. get more.
Insets insets = frame.getInsets();
int windowW = Math.max(applet.width, MIN_WINDOW_WIDTH) +
insets.left + insets.right;
int windowH = Math.max(applet.height, MIN_WINDOW_HEIGHT) +
insets.top + insets.bottom;
// Insets insets = frame.getInsets();
// int windowW = Math.max(applet.width, MIN_WINDOW_WIDTH) +
// insets.left + insets.right;
// int windowH = Math.max(applet.height, MIN_WINDOW_HEIGHT) +
// insets.top + insets.bottom;
int windowW = Math.max(applet.width, MIN_WINDOW_WIDTH);
int windowH = Math.max(applet.height, MIN_WINDOW_HEIGHT);
frame.setSize(windowW, windowH);
@@ -10654,9 +10655,12 @@ public class PApplet extends Applet
frame.setBackground(backgroundColor);
}
int usableWindowH = windowH - insets.top - insets.bottom;
// int usableWindowH = windowH - insets.top - insets.bottom;
// applet.setBounds((windowW - applet.width)/2,
// insets.top + (usableWindowH - applet.height)/2,
// applet.width, applet.height);
applet.setBounds((windowW - applet.width)/2,
insets.top + (usableWindowH - applet.height)/2,
(windowH - applet.height)/2,
applet.width, applet.height);
if (external) {