如何禁用(或隐藏)JFrame上的关闭(x)按钮? [英] How to disable (or hide) the close (x) button on a JFrame?

查看:868
本文介绍了如何禁用(或隐藏)JFrame上的关闭(x)按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个窗口(从JFrame派生),我想在某些不可中断的操作中禁用关闭按钮。我知道我可以通过调用

I have a window (derived from JFrame) and I want to disable the close button during certain operations which are not interruptible. I know I can make the button not do anything (or call a handler in a WindowListener) by calling

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

但我想直观地说明点击它是没有意义的。

but I would like to make it clear visually that it is pointless to click it.

推荐答案

如果我理解正确的话,此错误报告表明目前无法做到这一点。

If I understand it correctly, this bug report indicates that this is currently not possible.

这篇关于如何禁用(或隐藏)JFrame上的关闭(x)按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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