Java modal window with maximize button(带有最大化按钮的 Java 模态窗口)
问题描述
如何创建一个模态窗口并具有最大化按钮?
那么是否可以创建一个模态 JFrame 或创建一个带有最大化按钮的 JDialog ?
How could I create a window which is modal and has a maximize button?
So is it possible to create a modal JFrame or create a JDialog with maximize button?
推荐答案
在大多数外观和感觉上,模态窗口(例如 JDialog)没有最大化按钮只是因为它们不应该完全最大化(或最小化).
On most look and feels, modal windows (such as JDialog) do not have a maximise button simply because they're not supposed to be maximised (or minimised) at all.
通过一些技巧可以添加 maximise 按钮,但这完全违背了 JDialog 的工作方式.如果您需要最大化按钮,最好的解决方案是使用 JWindow 或 JFrame 而不是 JDialog.这些窗口支持最大化和最小化.
It's possible with some tricks to add a maximise button, but it would be completly against the way JDialog is supposed to work.
If you need a maximise button, the best solution would be using a JWindow or a JFrame instead of a JDialog. Those windows support maximisation and minimisation.
警告:无论如何你都不应该这样做.
WARNING: You shouldn't do that, no matter what.
在 JDialog 中执行此操作的技巧:
A trick to do this in JDialog:
setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
这篇关于带有最大化按钮的 Java 模态窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:带有最大化按钮的 Java 模态窗口
基础教程推荐
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- Struts2 URL 无法访问 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
