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!

JFrame resize according to content

843806Aug 14 2009 — edited Aug 15 2009
Hi,

My program generates JFrame components with one column of JPanels each containing one JLabel filling its panel. The generation of the components themselves is not the problem, rather the resizing of the JFrame according to the components' sizes. At the moment my settings for the preferred size of the JFrame cuts of most of the components lower down the column. If I'd use other sizes they may be too narrow / too wide for the text in the labels of the panels.

Is there a way to set the JFrame size according to the content?

My requirements would be:
Width -> All labels may not have broken lines
Height -> All panels in the column must be completely visible

I'd appreciate any help, thanks

Tim

Edited by: Geotim90 on Aug 14, 2009 1:47 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2009
Added on Aug 14 2009
25 comments
2,367 views