Automatic resizing of a Container
Frederic Gedin <[email protected]>
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
Hi Is there a way to automatically rezize a container when one of its components has changed its size? The organization of my various components can be represented in XML (SwiXML compliant) by: <panel id="panel_media" layout="borderlayout" border="EmptyBorder(10, 10, 10, 10)" constraints="BorderLayout.CENTER" > <vbox constraints="BorderLayout.CENTER" > <panel /> <panel id="panel_video" maximumsize="180,140" preferredsize="180,140" background="black" /> <panel id="control_video" maximumsize="180,35" preferredsize="180,35" border="BevelBorder(1)" /> <panel /> </vbox> </panel> When I change the size of the JPanel with ID "panel_video", I would like to have the whole JPanel with ID "panel_media" to be resized automatically. The Java code I use is: .... // retrieves JPanel with ID panel_video JPanel videoPanel = getVideoPanel(); // retrieves JPanel with ID panel_media JPanel mediaControlPanel = getMediaControlPanel(); ... Other changes inside videoPanel videoPanel.setSize(newSize); mediaPanel.updateUI(); I tried also by repacking the whole application frame without any success. Did I miss something? Regards Frederic