setMaximumSize 在java中不起作用
我有一个带有 JFrame 的 java 程序
I hava a java program with a JFrame
我使用的是绝对定位
这是我的主要功能
public static void main(String[] args) {
ape Ape = new ape();
Ape.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Ape.setSize(1000,1000);
Ape.setMinimumSize(new Dimension(1000,1000));
Ape.setMaximumSize(new Dimension(1000,1000));
Ape.setVisible(true);
}
当我运行程序时,我尝试调整它的大小并使窗口变小,但我做不到
When I run the program I try to resize it and make the window smaller but I can't
当我尝试使窗口更大时它工作正常我基本上跳过了 setMaximumSize()
函数
when I try to make the window bigger it works fine I basicly skips the setMaximumSize()
function
我已经阅读过,显然之前发生过这种情况
I have read around and aparently this has happened before
这是一个已知的错误吗?
is this a known bug?
如果是这样,我听说我可以制作一个 Window Listener,当我尝试它时,我实现了 WindowListener 所需的功能,但找不到任何东西来解决我的问题
if so I heard I could make a Window Listener, when I tried it I implemented the functions that WindowListener needed but could not find anything to solve my problem
请自己尝试一下,看看会发生什么......
please try this yourself and see what happens...
提前致谢
PS...请不要嘲笑我给我的班级起的名字...:)
PS... please don't laugh about the names I give my classes... :)
推荐答案
参见http://forums.sun.com/thread.jspa?threadID=5342801:
这是一个已知的错误:
- http://bugs.sun.com/bugdatabase/view_bug.做;?bug_id=6200438
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4744281
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4320050
也许你可以使用
Ape.setResizable(false)
改为?
PS:按照惯例,类名以大写字母开头,变量名以小写字母开头,反之亦然.
PS: It's a convention to give classes names that start with a capital letter and variables ones with a small letter, not vice versa.
相关文章