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!

JInternalFrame: maximizing and setting size of 'windowed'

843804Jan 7 2004 — edited Apr 30 2005
I want to maximize my JInternalFrame programatically, and set default size when the user window's it by clicking the 'window' icon on the top right corner of the frame.

I am able to do both, but not together.

To maximize I use this code:
        try {
            docIntFrame.setMaximum(true);
        } catch (PropertyVetoException e) {
            e.printStackTrace();  // Just print the stack trace
        }
And to set the default size when 'windowed' I use docIntFrame.setSize(dim);

The problem is that if I use setSize() together with setMaximum() JInternalFrame will behave strange. It will look and behave as if it was maximized, but it will not fill the whole JDesktopPane.

If I drop the setSize(), the JInternalFrame will be very small when windowed.

I cannot use JInternalFrame.setMinimumSize() since the content of the JInternalFrame is a scrollpane which should be able to be small.

Setting the content of the JInternalFrame's preferred sizes and sizes does not seem to affect how the JInternalFrame sizes.

Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2005
Added on Jan 7 2004
14 comments
1,064 views