Is there a way to set a z-order for buttons?

I have an image with buttons on top of it. I am resizing/redrawing the image, but then the buttons are behind the image. Is there a way to keep the buttons in the foreground without having to re-add them to the window?

You can use setComponentZOrder() on the window root container and apply a z-order to components within the root container. If you do this, you must apply a z-order to all of the components in the root container.

You can also move the component to the front of the Z order in the designer

I have a test with the setComponentZOrder() that seems like it will work for me.

Greg, since I have many buttons (300) predefined but they are all set to invisible and only shown at runtime as needed, if I move them to the front in the designer, will they still always be in the front even though the visible property is being toggled at runtime? If you aren’t sure, I will test it.

Yes, they will still be in the front of the Z order, you are just toggling the visibility.