Z changes transparency


I was having an issue with a panel being transparent when I didn’t want it to be. After trying lots of different things I realised that changing the z distance changed the transparency.

I can’t see anything in the lemur doc about this - there’s a reference to using z-order for layering but I’d assumed that would just be what was on top. I can’t work out why it would impact how transparent a panel is.

I’m using the glass style and haven’t changed anything from the default. I have tried setting the alpha for the panel, and for the buttons in the panel, but it doesn’t seem to make any difference - I’m assuming the style gets applied after I’ve created the component so my values are override.

Apologies if I’ve missed something obvious in the doc.

Here is the class that creates the panel:

public class OptionPanel extends Container {
	private final float width;

	public OptionPanel(String title, float width, float height) {
		super(new SpringGridLayout(Axis.Y, Axis.X, FillMode.Last, FillMode.Even));
		this.width = width;
		setPreferredSize(new Vector3f(width, height, 0f));
		setLocalTranslation(0f, 0f, 1f);
		Label label = new Label(title);

	public void addButton(String name, Runnable action) {
		Button button = new Button(name);
		button.addClickCommands(src -> action.run());

	public void addBlank(float height) {
		Panel blank = new Panel();
		blank.setPreferredSize(new Vector3f(width, height, 0f));


You’ve told it to flatten the z to 0… thus any layering is collapsed to the same Z value and may result in messed up sorting.

Did you know that there already is an OptionPanel? Or is this for something different?


I think OptionPanel is in proto right? I’m just using the main release at this stage. In any case it’s really just a name clash: this isn’t supposed to be a popup in the JOptionPane style. It’s closer to a menu with a list of buttons on it.

I took out the setPreferredStyle to see if it made any difference to transparency and it didn’t seem to change the visual behaviour at all.


I’d have to see the latest code and an example of what it would look like.

I’d expect at least the size of the panel to have changed.

When you say:

What exactly do you mean?

The Z of the panel, on its own, will have absolutely no effect on transparency unless there is something else in your GUI scene interacting with it.


By the way, in case it matters, if this panel is being added to the screen then this is actually off the bottom of the screen.

If it’s being added to something else… well that’s super important since that’s probably what it’s interacting with.


I’m sorry I should have said ‘didn’t change the visual behaviour with respect to transparency’. It definitely changed the size: the panel size became the default determined by the layout. But the panel still looks less transparent the greater the z.

The methods constructing the option panel set the x and y position and then attach it to the gui. Actually I create a node that’s attached to app.getGuiNode() and everything is attached to that. That’s just to make it easy to hide the whole gui when required. I’ll try to change it to just attach everything to the main gui node to see if that changes the behaviour.

I’ll try coming up with a basic app without anything else in the scene to see if I get the same behaviour.


You can also look at the demo app and see if messing with its z values has any effect. I’ve never seen this behavior myself.

If you post back and I don’t respond right away it’s because I’m sleeping… we are entering the part of the week where I must sleep for more than 2 hours in a row. :slight_smile:


Ha! Sleep is way overrated anyway :slight_smile:

I’m in Australia myself so just about sleep time for me too.

Thanks for your help.