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?