[英]How to make an empty view for JavaFX TabPane
Sorry if this question has been answer previously, but I'm having a hard time finding it (I'm probably just not searching for the right stuff). 抱歉,如果您以前已经回答过这个问题,但是我很难找到它(我可能只是没有在寻找合适的东西)。
I have a TabPane
with tabs that can be closed. 我有一个
TabPane
其中的标签可以关闭。 When all the tabs are closed, I'm presented with an empty pane. 关闭所有选项卡后,将显示一个空白窗格。 Is there a way to have a custom message displayed in this empty area?
有没有办法在此空白区域显示自定义消息?
I've thought of just stacking a view on top and binding it's visibility to the tab count == 0, but I know the several JavaFX controls (such as the ListView
, TableView
, and TreeView
) have this functionality built in, and I was wondering if there was a similar built in (or at least simple) method for doing so with a TabPane
. 我曾想过只在顶部堆叠视图并将其可见性绑定到制表符计数== 0,但是我知道几个JavaFX控件(例如
ListView
, TableView
和TreeView
)都内置了此功能,想知道是否有使用TabPane
进行类似(或至少简单)的内置方法。
PS I am aware that the TabPane
is a container and not a control so it won't work the same as the controls I mentioned, but I can't imagine this use case has never come up. PS:我知道
TabPane
是一个容器,而不是一个控件,因此它不能与我提到的控件一样工作,但是我无法想象这种用例从未出现过。
Could you use a StackPane which contains TabPane. 您可以使用包含TabPane的StackPane吗? Handle tab close event and if no tabs add a custom pane containing text to the StackPane?
处理选项卡关闭事件,如果没有选项卡将包含文本的自定义窗格添加到StackPane?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.