Setting minimum size limit for a window in java swing
Posted
by shadyabhi
on Stack Overflow
See other posts from Stack Overflow
or by shadyabhi
Published on 2010-05-06T14:42:02Z
Indexed on
2010/05/07
3:08 UTC
Read the original article
Hit count: 340
I have a JFrame which has 3 JPanels in GridBagLayout..
Now, when I minimize a windows, after a certain limit, the third JPanel tends to disappear. I tried setting minimizing size of JFrame using setMinimumSize(new Dimension(int,int)) but no success. The windows can still be minimized.
So, I actually want to make a threshhold, that my window cannot be minimized after a certain limit.
How can I do so?
Code:-
import java.awt.Dimension;
import javax.swing.JFrame;
public class JFrameExample {
public static void main(String[] args) {
JFrame frame = new JFrame("Hello World");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setMinimumSize(new Dimension(400, 400));
frame.setVisible(true);
}
}
Also:
shadyabhi@shadyabhi-desktop:~/java$ java --showversion
java version "1.5.0"
gij (GNU libgcj) version 4.4.1
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Usage: gij [OPTION] ... CLASS [ARGS] ...
to invoke CLASS.main, or
gij -jar [OPTION] ... JARFILE [ARGS] ...
to execute a jar file
Try `gij --help' for more information.
shadyabhi@shadyabhi-desktop:~/java$
Gives me output like
© Stack Overflow or respective owner