如何禁用 JFrame 中的最小化按钮? [英] How to disable the minimize button in JFrame?

查看:63
本文介绍了如何禁用 JFrame 中的最小化按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以禁用 JFrame 中的 最小化 按钮吗?

Can I disable the minimize button in JFrame?

我已经尝试过 setUndecorated() 和 setResizable() 但都没有奏效.

I have already tried setUndecorated() and setResizable() but both did not work.

我正在尝试将图像添加到随机位置的面板(有效)但是当 JFrame 通过单击 minimize 按钮最小化时(不是当框架通过单击背景窗口最小化时)) 图像在顶部连续排列.

I'm trying to add images to a panel at a random location (which works) but when the JFrame is minimized by clicking at the minimize button (not when frame minimizes by clicking the background window) images assemble at the top in a row.

有人可以帮忙吗?

谢谢!

推荐答案

如果您还想禁用最大化按钮,那么您可以使用 JDialog 而不是 JFrame...据我所知您不能禁用最小化按钮在 JFrame 中.JDialog 只有一个关闭按钮.希望这有帮助

If you also want to disable the maximize button then you can use a JDialog instead of a JFrame... as far as I know you cannot disable the minimize button in a JFrame. JDialog only has a close button. Hope this helps

这篇关于如何禁用 JFrame 中的最小化按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆