views:

48

answers:

2

[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.

+1  A: 

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.

Riduidel
Thanks, and yes I agree. And also look at JXLayer. However, I was hoping for some ideas for what "architecture" to use to do such decoration. A central "Highlight manager" that all these components register to? What about repaint and resizes? Resize of the component, or of the window, while in the hightlight-mode?
stolsvik
+2  A: 

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.

Andy
I saw your comment below. Regarding resizing, I believe once you get the view set up with the whiteout effect JXLayer would, by nature, take care window resizing and repainting. This assumes your whiteout view queries the current component sizes/positions in order to figure out what area no to whiteout.
Andy