SceneBuilder中的JavaFx StackPane,如何只显示前窗格而不设置禁用其他人的可见性? [英] JavaFx StackPane in SceneBuilder, how to make only front pane visible without setting disabling visibility of others?

查看:360
本文介绍了SceneBuilder中的JavaFx StackPane,如何只显示前窗格而不设置禁用其他人的可见性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关问题:节点 - 选择要显示的图层JavaFX2

我正在使用带有SceneBuilder 2的JavaFx 8.我有许多窗格作为StackPane的子窗口,我只想制作前端节点可见。我需要在不禁用其他孩子的可见性的情况下执行此操作,并且我尝试使用下面看到的不透明度设置执行此操作(忽略可见性已禁用的事实):

I'm using JavaFx 8 with SceneBuilder 2. I have a number of panes as children of a StackPane and I would like to make only the front Node visible. I need to do this without disabling visibility of the other children, and I've tried to do this using the opacity setting seen below (ignore the fact that visibility is disabled):

不禁用可见性对于其他子节点,即使使用不同的混合模式(SRC_OVER& SRC_ATOP),子节点也总是相互绘制,如下所示:

Without disabling the visiblity of the other child nodes, the children are always drawn over each other, even when using different blend modes (SRC_OVER & SRC_ATOP), as seen below:

我想避免设置的原因对子元素的false的可见性是我想要在窗格之间设置过渡的动画,其中一个窗格需要在另一个窗格的顶部绘制。

The reason I would like to avoid setting visibility to false of the child elements is that I want to animate a transition between the panes, in which one pane needs to be draw over the top of the other.

I我必须在这里遗漏一些明显的东西,但我看不出它是什么?

I must be missing something obvious here, but I can't see what it is?

推荐答案

答案是设置背景颜色的窗格。如果没有先设置背景颜色,则不透明度无效。

The answer is to set the background colour of the panes. Opacity has no effect without first setting a background colour.

这篇关于SceneBuilder中的JavaFx StackPane,如何只显示前窗格而不设置禁用其他人的可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆