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
**UPDATE: ** The same when run though Netbeans IDE gives expected output.. When I run through "java JFrameExample" compiler, I am facing issues.. Now, what that means??
解决方案
The documentation tells me, that this behavior is platform dependent. Especially, since the following example code works for me as desired in Windows Vista:
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(100, 100));
frame.setVisible(true);
}
}