how to javafx hide background header of a tableview?
http://stackoverflow.com/questions/12324464/how-to-javafx-hide-background-header-of-a-tableview
————————————————————————————————————————————————————————
I'm trying to develop auto complete text, which shows a dropdown of suggestions in tableview popup, and I'm having an issue of how can I hide the whole header-column of tableview in javafx 2.1
2 Answers
|
The solution is very simple; after the tableview renders, we can get the table header and make invisible, therefor the table header doesn't have to re-layout when the table view layout changes. To catch table rendering is done, we can use width property change, and hide the table header Here is the code: |
tableView.widthProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
// Get the table header
Pane header = (Pane)tableView.lookup("TableHeaderRow");
if(header!=null && header.isVisible()) {
header.setMaxHeight(0);
header.setMinHeight(0);
header.setPrefHeight(0);
header.setVisible(false);
header.setManaged(false);
}
}
});
**********************************************
Apply a custom stylesheet to the table:
table.getStylesheets().addAll(getClass().getResource("hidden-tableview-headers.css").toExternalForm());
Where the file hidden-tableview-headers.css is placed in the same location as the class loading the css resource and contains the line:
.column-header-background { visibility: hidden; -fx-padding: -1em; }
The visibility: hidden attribute tells JavaFX not to draw the node, but still leave space where the heading was. As the header is 1 row of text height high, you can tell the invisible header not to take up any space by setting -fx-padding: -1em;.
|
|
Thanks jewelsea, but this will keep an empty space instead of the column header, and I want to remove it. – Anas Aswad Sep 11 '12 at 11:08
|
||
|
|
Added a -fx-padding setting to the suggested css so that the invible column header does not take up any space on the screen (as recommended by an anonymous stackoverflow user). – jewelsea Jun 5 at 21:53
|
how to javafx hide background header of a tableview?的更多相关文章
- javafx将数据库内容输出到tableview表格
一 .创建Fxml文件,用Javafx Scene Builder 编辑页面,创建tableview(表格)和tablecolum(表格中的列),并为其设置fxid: 二.生成fxml文件的控制类: ...
- javafx基于使用fxml布局的tableview数据绑定用法
来个简单明了的 fxml的tableview数据绑定和java代码方式的数据绑定很像,不同的在于要有一到映射 首先看个目录 1.界面文件Sample.fxml <?xml version=&qu ...
- iOS UITableView ExpandableHeader(可形变的Header)
最常见的header就是在tableView下拉时header里的图片会放大的那种, 最近研究了一下,自己实现了这种header. 1.设置TableView的contentInset(为header ...
- JavaScript资源大全中文版(Awesome最新版)
Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...
- python解析git log后生成页面显示git更新日志信息
使用git log可以查到git上项目的更新日志. 如下两个git项目,我想把git的日志信息解析成一个便于在浏览器上查看的页面. https://github.com/gityf/lua https ...
- 知问前端——Ajax提交表单
本文,运用两大表单插件,完成数据表新增的工作. 一.创建数据库 创建一个数据库,名称为:zhiwen,表——user表,字段依次为:id.name.pass.email.sex.birthday.da ...
- wesome-android
awesome-android Introduction android libs from github System requirements Android Notice If the lib ...
- Github上有趣的资料 | JS
留着,以后用得着,原文地址:http://www.jianshu.com/p/7c9aa9508641 collection AlloyImage 基于HTML5的专业级图像处理开源引擎.An ima ...
- UITableView的创建及其一些常用方法
UITableView,它的数据源继承于UITableViewDataSource,它的委托UITableViewDelegate. 一.UITableView的创建 1.代码方式: UITableV ...
随机推荐
- 第五讲:深入hibernate的三种状态
学过hibernate的人都可能都知道hibernate有三种状态,transient(瞬时状态),persistent(持久化状态)以及detached(离线状态),大家伙也许也知道这三者之间的区别 ...
- zookeeper监控告警
一.ZooKeeper简介 ZooKeeper作为分布式系统中重要的组件,目前在业界使用越来越广泛,ZooKeeper的使用场景非常多,以下是几种典型的应用场景: l 数据发布与订阅(配置中心) l ...
- HDU 1564 (博弈) Play a game
这道题的答案猜也很好猜出来,但是想太难想了..题解一贴,然后闪人.. 请戳这
- UVA 489 Hangman Judge (字符匹配)
题意:给一个字符串A,只含小写字符数个.再给一个字符串B,含小写字符数个.规则如下: 1.字符串B从左至右逐个字符遍历,对于每个字符,如果该字符在A中存在,将A中所有该字符删掉,若不存在,则错误次数+ ...
- HiveQL 与 SQL的异同
1 select 别名 (1)别名一定要加as 例:select ID as stuID from students (2) Hive QL不支持在group by, order by 中使用sele ...
- ecshop 在首页每个商品下显示已销售数量
1.在includes/lib_goods.php文件末尾加入以下代码 function get_buy_sum($goods_id) { $sql = "select sum(goods_ ...
- XE7 - 升级及初步使用
春节没抢到回家的票,正好有时间把Delphi2010升级到了XE7. 用了快一个月了,今天算是补记. 安装包用了lsuper大侠整理的lsuper.XE7.Update1.v10.1.拜谢!比较顺利的 ...
- 本地Git环境配置
在Git Bash下获取源码时,提示permission denied publickey. 原因是本地帐号配置不正确,解决办法 生成SSH文件 1,进入Git Bash 2, 输入下面文字 ssh ...
- [转] C#操作Excel文件
来自 jbp74c37ad170 的文章EXCEL编程语句有那些啊 全面控制 Excel首先创建 Excel 对象,使用ComObj:Dim ExcelID as Excel.Application ...
- [Everyday Mathematics]20150302
$$\bex |p|<\frac{1}{2}\ra \int_0^\infty \sex{\frac{x^p-x^{-p}}{1-x}}^2\rd x =2(1-2p\pi \cot 2p\pi ...