"Whiteout" entire swing GUI except from one component
[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.
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.
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.
精彩评论