Not that I want to deter you from this method of doing things… but using a fullscreen Panel with/or without setIgnoreMouse(true) and then adding the buttons to the panel as children would have done this without any of the z-order issues you just described.
[java]
// Create the panel this way then add you bg image, or use the extended contrustor that sets the color map at instantiation
Panel bg = new Panel(screen, Vector2f.ZERO, new Vector2f(screen.getWidth(),screen.getHeight()));
ButtonAdatper b1 = new ButtonAdapter(screen, new Vector2f(x,y) {
@Override
public void onButtonMouseLeftUp(MouseButtonEevent evt, boolean isToggled) {
// some code here
}
};
bg.addChild(b1);
screen.addElement(bg);
// etc, etc
[/java]
if you need the background to ignore mouse clicks…
[java]
bg.setIgnoreMouse(true);
[/java]
If you simply want it to never alter it’s z-order when clicked
[java]
bg.setEffectZOrder(false);
[/java]
If you want the buttons to bring the entire control to the front of the screen keeping the children’s z-order intact:
[java]
b1.setEffectParent(true); // This forwards events like z-order change, resize, move to the parent element
[/java]
If it is a deep-nested control:
[java]
b1.setEffectAbsoluteParent(true); // forwards to the screen level control the button is nested within.
[/java]
Anyways, point being… there are many ways to set up what you’re trying to accomplish just using the provided control. Once it moves outside the realm of JME… that’s a different story.
Otherwise, I am completely missing the question from the explanation
Which I did the first time… so it’s likely I’ll do it again.