X don't popup offscreen if editor window is way left.

X   just make sure the x coord > 10 or so (if not presenting)
X     if so, pop up window 50, 50 from upper left corner
X   if it still won't fit, center the window on screen
This commit is contained in:
benfry
2002-09-02 02:52:18 +00:00
parent de22f7b105
commit da9fe9f137
2 changed files with 40 additions and 23 deletions

View File

@@ -729,7 +729,21 @@ public class KjcEngine extends PdeEngine {
int mh = PdeBase.getInteger("run.window.height.minimum", 120);
int ww = Math.max(applet.width, mw) + insets.left + insets.right;
int wh = Math.max(applet.height, mh) + insets.top + insets.bottom;
window.setBounds(x1 - ww, y1, ww, wh);
if (x1 - ww > 10) { // if it fits to the left of the window
window.setBounds(x1 - ww, y1, ww, wh);
} else { // if it fits inside the editor window
x1 = parentLoc.x + PdeEditor.GRID_SIZE * 2;
y1 = parentLoc.y + PdeEditor.GRID_SIZE * 2;
if ((x1 + ww > screen.width - PdeEditor.GRID_SIZE) ||
(y1 + wh > screen.height - PdeEditor.GRID_SIZE)) {
// otherwise center on screen
x1 = (screen.width - ww) / 2;
y1 = (screen.height - wh) / 2;
}
window.setBounds(x1, y1, ww, wh);
}
Color windowBgColor =
PdeBase.getColor("run.window.bgcolor", SystemColor.control);