Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Keeping layout in synch with screen resolution

843804Nov 5 2004 — edited Dec 19 2009
I just discovered a problem with my GUI application: The layout of my JFrames are disproportional across different screen resolutions. That is, on my laptop where I'm developping my program, I've layed out all components of my interfaces nicely so that they are all visible within the JFrame based on the width and hight of the JFrame. However, just a moment ago, I transferred my program to another computer, recompiled and ran it, and found that a lot of components in a lot of my interfaces have been pushed passed the right and bottom edges of the JFrames. For example, I have some Accept and Cancel buttons on the bottoms of some JFrames which are no longer visible because their X and Y coordinates surpass the boundaries of the JFrame itself. Note that I'm not saying that it's extending passed the edge of the screen, which means that it would seem that the JFrame sizes itself differently than its components. That is, where the size of the JFrame seems to depend on some kind of Windows/Desktop pixel-size system, the JFrame's components seem to depend on some kind of Swing pixel-size system. How can I tell the JFrame to size itself according to the current resolution?

Keep in mind, I'm using a null LayoutManager. I'd prefer to keep it this way since I like having full control over where I place my components.

Gib
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 16 2010
Added on Nov 5 2004
4 comments
836 views