These are my observations (using 1.6, now I use 1.7 under XP):
You can have a limited frame of "almost" any size - I use a screen resolution of 1280x1024 (rotated) and did not notice any problems with the 1500x1500 frame, although some 2000x2000 frames look incomplete (but work) and a 4000x4000 frame displays the thumb on the taskbar, but this thumb is inactive and the frame itself is not displayed. I think the largest unecorated JFrame size depends on system capabilities, which depend on the graphics hardware.
There is a simple story with decorated frames - they can be slightly larger than the screen size (by a few pixels in general).
In my application with a size determined at runtime (for example, in games where you set the board size dynamically), I use the following approach:
one). Before packing, set the frame to zero. It puts the top left corner of the JFrame in the middle of the screen (before the JFrame package is (0,0))
2). set the preferred dimensions of the contents of my frame (I always use one JPanel) and remember them
3). pack frame
4). if the frame sizes after the package do not match the dimensions before packing, delete the contents of the JPanel, add a JScrollPane with this JPanel and set the preferred JScrollPane sizes as the preferred JPanel sizes. PLUS the fixed dimensions of the JScrollBar (i.e. the width of the vertical scrollbar and the height of the horizontal).
5). pack again - this ensures that only the necessary scroll bars appear (if you do not increase the size of the JFrame, then the scroll bars appear), you also need to remove the default JScrollPane border).
6). Set a new location for the frame by moving it left and up half the size to center it.
Tomek
source share