删除“X” Swing JDialog中的按钮 [英] Remove "X" button in Swing JDialog

查看:62
本文介绍了删除“X” Swing JDialog中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从 JDialog 标题栏中删除关闭按钮(X)?

Is there a way to remove the close button ("X") from the JDialog title bar?

推荐答案

您可以通过调用dialog.setUndecorated(true)删除整个对话框标题,但这意味着该对话框不能再移动。

You can remove the whole dialog title by calling dialog.setUndecorated(true) but this means that the dialog can't be moved anymore.

您还可以执行dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE)以防止按钮执行任何操作。

You can also execute dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) to prevent that the button does anything.

除此之外,我认为没有完全删除X的方法。

Beside that, I don't think that there's a way to remove the X completely.

这篇关于删除“X” Swing JDialog中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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