相关疑难解决方法(0)

在java swing中设置窗口的最小大小限制

我有一个JFrame,在GridBagLayout中3个JPanel ..

现在,当我最小化窗口时,在一定限制之后,第三个JPanel趋于消失.我尝试使用setMinimumSize(new Dimension(int,int))设置最小化JFrame的大小但没有成功.窗户仍然可以最小化.

所以,我实际上想做一个门槛,我的窗口在一定限度后无法最小化.

我怎么能这样做?

码:-

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

也:

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 …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing jframe

26
推荐指数
2
解决办法
5万
查看次数

标签 统计

java ×1

jframe ×1

swing ×1

user-interface ×1