JavaFX 2:TableView:删除标题+显示网格时为空 [英] JavaFX 2 : TableView : remove header + show grid when empty

查看:1106
本文介绍了JavaFX 2:TableView:删除标题+显示网格时为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Javafx2中的TableView有2个问题:



1)
是否可以隐藏表格中的标题?



2)
当表为空时,它只显示一个白色窗格,表示表中没有内容。
如果可能的话,Id就像一个带有CSS的解决方案(javacode是一个简单的方法),可以改变这个显示默认网格,即使表是空的吗?


解决方案

回答第一个问题是此处。请注意,您只能在呈现表格后才隐藏标题。



回答您的第二个问题,您可以使用以下方法:

  table.setPlaceholder(new Label(Placeholder)); 

您可以添加任何 Node


I have 2 questions about the TableView in Javafx2:

1) Is it possible to hide the headers in your table?

2) When the table is empty it just shows a white pane saying "No content in table.". Is it possible to change this to display the default grid, even when the table is empty?

If possible, Id like a solution with CSS (javacode is also fine).

Thank you in advance.

解决方案

Answer to the first question is here. Note that you may hide the headers only after the table is rendered.

Answering your second question you may use following approach:

table.setPlaceholder(new Label("Placeholder"));

Instead of label you may add any Node.

这篇关于JavaFX 2:TableView:删除标题+显示网格时为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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