Component visibility change question


#1

When I call setVisible() on a component, I don’t seem to get visibilityChanged() events called on its children. Is this to be expected? Intuitively it seems like it should be called, since the children will start/stop being rendered after setVisible().

Looking at the implementation I couldn’t see anything that would notify children, but its quite possible i missed something, and my problem is caused by something else.

Thanks in advance for any help!


#2

No, there’s a subtle difference between “visible” and “showing”. visibilityChanged only tells you when that component is itself changed. If you need notification about its parents, you can use a ComponentListener to catch hierarchy-change notifications, and check isShowing() to find out if it’s still on screen.


#3

ahh - ok. thanks!