Propagating JPanel changes to ancestors

Hello,

Is there a clean way to propogate changes made to a JPanel (components being added,removed, resized..) to the ancestors, preferrably the top-level (internal) frame so i can call pack() to make it resize..

i was planning on building a system my self based on some kind of LayoutChangeHandler interface that you can register on a panel but wanted to check first if there wasn't something built in already

thanks a lot in advance!

[460 byte] By [phonkera] at [2007-10-2 4:40:59]
# 1
panel.invalidate() seems the good call.
Franck_Lefevrea at 2007-7-16 0:14:04 > top of Java-index,Desktop,Core GUI APIs...
# 2

that doesn't really solve the problem

i have a JPanel in a JInternalFrame which visibility depends on the state of a button.. i want to frame to grow when the panel is visible and shrink when its not (now i have to manually resize the frame to find the panel...)

calling invalidate() on the panel doesn't seem to do anything, neither does repaint() or updateUI() ...

any got any idea ?

phonkera at 2007-7-16 0:14:04 > top of Java-index,Desktop,Core GUI APIs...
# 3
call pack() on the internal frame.
camickra at 2007-7-16 0:14:04 > top of Java-index,Desktop,Core GUI APIs...
# 4
You could try adding a component or container listener to the appropriate nodes of your containment hierarchy and respond to those events by packing the internal frame as required.Hope this helps.
KPSeala at 2007-7-16 0:14:04 > top of Java-index,Desktop,Core GUI APIs...
# 5
okay i'll do that, i was planning on doing that but wanted to check if there wasn't something built in alreadyall of you, thank you very much your responsesgreetings,PJ
phonkera at 2007-7-16 0:14:04 > top of Java-index,Desktop,Core GUI APIs...