“白化”除了一个组件之外的整个 Swing GUI

发布于 2024-09-16 16:22:36 字数 365 浏览 5 评论 0原文

[这个问题与这个问题< /a>]

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

挑战:点击编辑时,我希望整个 UI 都“变白”(编辑标签区域除外),以清楚地向用户指示他应该关注的位置。

[This question is in relation to this question]

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.

The Challenge: When hitting edit, I want the entire UI to be "whited out", except for the edit-label's area, to clearly denote to the user where it is expected that he should focus.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

℡Ms空城旧梦 2024-09-23 16:22:36

或者,这可以使用 JXLayer 项目来实现。看看他们的一些演示,当选择一个项目时,他们会模糊 GUI。您必须实现自己的 JXLayer 视图才能使 GUI 变白。

项目网址:https://jxlayer.dev.java.net/

演示位于“获取已开始”首页上的项目。

Alternative, this could be achieved using the JXLayer project. Take a look at some of their demos where they blur out the GUI when an item is selected. You would have to implement your own JXLayer view in order to white out your GUI.

Project URL: https://jxlayer.dev.java.net/

Demos are under the "getting started" item on the front page.

烧了回忆取暖 2024-09-23 16:22:36

您可以查看 玻璃窗格 的可能用法 ...

已更新质疑作者的评论。

此类问题通常通过个人实施 Look'n'Feel 来解决。

通常,需要屏幕的组件将具有为此目的设置的客户端属性。 LnF 为该组件创建了渲染组件,也注册了一个侦听器。设置此属性后,组件会触发一个事件,LnF 将接收该事件。在活动接待处,玻璃板被安装在整个集装箱框架上。

You could take a look at possible usages of the glass pane ...

UPDATED due to question author's comment.

This kind of problemn is typically solved by a personnal implementation of Look'n'Feel.

Typically, the component requiring the screen will have a client property set for that purpose. The LnF, which has created a rendering compoent for that component, has also registered a listenr. When this property is set, an event is fired by component, that LnF will receive. At event reception, a glass pane is then installed over the whole container frame.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文