int x = xofs + (xsep * frame_count) % (int) (screenSize.getWidth() - frameSize.getWidth() - xofs); if (x < 0) x = 0; int y = yofs + (ysep * frame_count) % (int) (screenSize.getHeight() - frameSize.getHeight() - yofs); if (y < 0) y = yofs + ysep;
int x, xRemain; xRemain = (int) (screenSize.getWidth() - frameSize.getWidth() - xofs); x = xRemain > 0 ? (xofs + (xsep * frame_count) % xRemain) : xofs; if (x + frameSize.getWidth() > screenSize.getWidth()) { x = xofs; if (x + frameSize.getWidth() > screenSize.getWidth()) x = 0; } int y, yRemain; yRemain = (int) (screenSize.getHeight() - frameSize.getHeight() - yofs); y = yRemain > 0 ? (yofs + (ysep * frame_count) % yRemain) : yofs; if (y + frameSize.getHeight() > screenSize.getHeight()) { y = yofs; if (y + frameSize.getHeight() > screenSize.getHeight()) y = 0; }
    Point getDefaultLocation(Dimension frameSize) {        int xofs = 0;        int yofs = 0;        if (!useMDI()) {            if (isMac) {                xofs = 100;                yofs = 100;            } else {                JFrame tb = ((JSLFakeDesktop) proxy).toolbar.getJFrame();                if (tb.getLocation().getY() < 100) { // Do we need this check?                    xofs = (int) tb.getLocation().getX();                    yofs = (int) (tb.getLocation().getY() + tb.getSize()                            .getHeight());                }            }        }        int xsep = 30;        int ysep = isMac || useMDI() ? 30 : ydecoration;        Dimension screenSize = getSize();        int x = xofs + (xsep * frame_count) % (int) (screenSize.getWidth() - frameSize.getWidth() - xofs);        if (x < 0)            x = 0;        int y = yofs + (ysep * frame_count) % (int) (screenSize.getHeight() - frameSize.getHeight() - yofs);        if (y < 0)            y = yofs + ysep;        frame_count++;        return new Point(x, y);    }