java 有没有办法把窗户修好?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1840113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any way to make a window fixed?
提问by user187920
Is there any way to make a window fixed so that the user can't change the window size in java?
有什么办法可以使窗口固定,以便用户无法在 java 中更改窗口大小?
回答by coobird
The Frameclass (and its child JFrameclass for Swing) there is a setResizablemethod which will set whether or not a Framecan be resized or not.
将Frame类(和它的子JFrame对Swing类)有一种setResizable将设置与否的方法Frame可以调整大小与否。
回答by cyphrt
JFrame myFrame= new JFrame();
myFrame.setResizable(false);
My solution.
我的解决方案。
回答by kaushik
In the Frame class, there is a setResizable method which will set whether or not a Frame can be resized or not. So, if you want to fixed window than just write setResizable(false).
在 Frame 类中,有一个 setResizable 方法可以设置是否可以调整 Frame 的大小。所以,如果你想固定窗口而不是只写 setResizable(false)。

