开发者

What's a HierarchyListener for?

Well, I guess it's for listening to hierarchy changes but I don't really unde开发者_JS百科rstand what this means in practise.

Anyone has a good real life example when this should/could be used ?

Thanks David


I used it once.

I was building a bubble-tip(a tooltip but with an arrow pointing to a target component) component. I used JLayeredPane with POPUP_LAYER to implement it. So whenever the target component changed it's position or resized, I wanted a notification so that i could adjust my tip's arrow to point to it. This is my practical usage of HeirarchyListener. Now why could'y have I used ComponentListener ;)?


One example would be a component that should do something (e.g. display an animation) whenever it becomes visible. Its own visibility attribute is not sufficient, since visibility is inherited. A HierarchyListener allows it to be notified when the inherited visibility status changes.

Also: http://www.google.com/search?q=%22implements+HierarchyListener%22

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜