How can I change panel Z-order at run-time?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sergio_Panico
Posted On:   Saturday, April 19, 2003 01:26 PM

Hi! I have 2 panels and I need to bring one to front and send the other on background by clicing on Jbutton! How I can do it?

Re: How can I change panel Z-order at run-time?

Posted By:   Bahman_Barzideh  
Posted On:   Saturday, April 19, 2003 02:07 PM

The children of a Container are ordered front to back (child at index 0 is in front of all the others. Child at the last index is behind all
others). To bring a Component to the front you need to remove
from its parent and add it back to its parent with the correct index. For example the following code will bring the 5th child to the front (on top of all its siblings ):

Component child = parent.remove (4);
parent.add (child, 0);

See the manual page for Container for more information.



Also note that you may have to revalidate () and repaint () the parent for the change to become visible.
About | Sitemap | Contact