除了一个组件之外,阻止整个摆动ui - “对话框样式”。 [英] Block entire swing ui except for one component - "dialog style"

查看:119
本文介绍了除了一个组件之外,阻止整个摆动ui - “对话框样式”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[此问题与此问题有关]

设置:我有这个自制的可编辑标签组件,看起来像一个标签,但当你点击它时,它变成了一个可编辑的字段,允许您编辑它。您可以点击Esc取消,或按Shift-Enter确认您的修改 - 或点击可编辑字段下方的相应按钮。

Setting: I have this home-crafted "editable label" component which looks like a label, but when you click it, it turns into an editable field, allowing you to edit it. You can hit Esc to cancel, or Shift-Enter to OK your edits - or click the respective buttons beneath the editable field.

挑战 :当你进入这个编辑模式时,我希望完全阻止UI的其余部分:你可以取消或者完成编辑,然后再做其他事情。在写这篇文章时,我意识到显而易见:这正是一个对话框的运作方式 - 但我喜欢我的文档内编辑标签比打开一个对话框更好。

The challenge: When you go into this edit-mode, I want the rest of the UI to be completely blocked: You shall either cancel or OK the edit before being able to do anything else. While writing this, I realize the obvious: This is exactly how a dialog operates - but I like my "in-document" edit-label better than opening a dialog.

推荐答案

玻璃窗格可能就是这样。您可以轻松窃取所有事件并将一些事件发送到您的自定义对象。这篇文章讨论了实现一个行为良好的玻璃板<的方法/ a>。

Glass pane might be the way to go. You can easily steal all the events and send some to your custom object. Here is an article that discusses a way to implement A wellbehaved glasspane.

这篇关于除了一个组件之外,阻止整个摆动ui - “对话框样式”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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