frame.setLocation(GUIPreferences.getInstance().getWindowPosX(), GUIPreferences.getInstance().getWindowPosY()); frame.setSize(GUIPreferences.getInstance().getWindowSizeWidth(), GUIPreferences.getInstance().getWindowSizeHeight());
int x = GUIPreferences.getInstance().getWindowPosX(); int y = GUIPreferences.getInstance().getWindowPosY(); int w = GUIPreferences.getInstance().getWindowSizeWidth(); int h = GUIPreferences.getInstance().getWindowSizeHeight(); if (x < virtualBounds.getMinX() || x + w >virtualBounds.getMaxX()) x = 0; if (y < virtualBounds.getMinY() || y + h >virtualBounds.getMaxY()) y = 0; if(w > virtualBounds.getWidth()) w = (int)virtualBounds.getWidth(); if(h > virtualBounds.getHeight()) h = (int)virtualBounds.getHeight(); frame.setLocation(x, y); frame.setSize(w, h);
    private void initializeFrame() {        this.frame = new Frame(Messages.getString("ClientGUI.title")); //$NON-NLS-1$        menuBar.setGame(client.game);        frame.setMenuBar(menuBar);        if (GUIPreferences.getInstance().getWindowSizeHeight() != 0) {            frame.setLocation(GUIPreferences.getInstance().getWindowPosX(), GUIPreferences.getInstance().getWindowPosY());            frame.setSize(GUIPreferences.getInstance().getWindowSizeWidth(), GUIPreferences.getInstance().getWindowSizeHeight());        } else {            frame.setSize(800, 600);        }        frame.setBackground(SystemColor.menu);        frame.setForeground(SystemColor.menuText);        frame.setIconImage(frame.getToolkit().getImage("data/images/misc/megamek-icon.gif")); //$NON-NLS-1$    }