Java Utililty Methods JFrame Size

List of utility methods to do JFrame Size

Description

The list of methods to do JFrame Size are organized into topic(s).

Method

voidrestrictWindowMinimumSize(final JInternalFrame frame, final Dimension minSize)
Adds listener to internal frame that ensures that the frame is not resized less then specified size.
restrictMinimumSizeImpl(frame, minSize);
voidsetMinMaxSizeFrame(JFrame frame)
set Min Max Size Frame
setMinSizeFrame(frame);
setMaxSizeFrame(frame);
frame.setResizable(false);
voidsetMinSizeFrame(JFrame frame)
set Min Size Frame
Dimension dimension = frame.getSize();
frame.pack();
frame.setMinimumSize(frame.getSize());
frame.setSize(dimension);
voidsetSizeBasedOnResolution(final JFrame frame)
Set the size of the JFrame based on the resolution of the screen
Dimension dimension = getDimensionBasedOnResolution();
frame.setSize(dimension.width, dimension.height);
voidsetSizeWithinScreen(JFrame frame, int preferredWidth, int preferredHeight)
set Size Within Screen
Dimension screenSize = getMaxSize(frame);
frame.setSize(new Dimension(Math.min(preferredWidth, screenSize.width),
        Math.min(preferredHeight, screenSize.height)));
voidshowSplashWindow(String message, Font messageFont, int duration, Dimension windowSize, Window frameOwner)

Displays a splash window for a specific amount of time with a set of rendering parameters for the message, font type, window size and frame owner.

JLabel saved = new JLabel(message);
saved.setHorizontalAlignment(JLabel.CENTER);
saved.setOpaque(true);
saved.setFont(messageFont);
final JWindow window = new JWindow(frameOwner);
window.add(saved, BorderLayout.CENTER);
window.setSize(windowSize);
saved.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
...