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的三种状态 瞬时:bean对象与session,与数据库无关.在session对象的save方法保存之前. 持久状态(托管):bean对象与session有关,数据库中有对应 ...
- ImageView 设置图片
android doc中是这样描述的: public void setImageResource (int resId) 这是其中的一个方法,参数resld是这样: ImageView.setIm ...
- poj2942 Knights of the Round Table 双连通分支 tarjan
题解:http://blog.csdn.net/lyy289065406/article/details/6756821 讲的很详细我就不多说了. 题目连接:http://poj.org/proble ...
- [转] POJ图论入门
最短路问题此类问题类型不多,变形较少 POJ 2449 Remmarguts' Date(中等)http://acm.pku.edu.cn/JudgeOnline/problem?id=2449题意: ...
- iOS8 LaunchScreen.storyboard
我目前的需求是需要将启动图片通过LaunchScreen.storyboard 来实现. 我首先想到的是创建一个Sb,使用自动布局来布局imageview,并设置如下图: 布局好之后,在Image里 ...
- android 自定义控件中获取属性的三种方式(转)
第一种方法,直接设置属性值,通过attrs.getAttributeResourceValue拿到这个属性值. (1)在xml文件中设置属性值 <com.example.activity.Ico ...
- xunsearch迅搜体验
安装与启动 http://www.xunsearch.com/doc/php/guide/start.installation 编写配置文件 http://www.xunsearch.com/doc/ ...
- ProgressBar 各种样式
多式样ProgressBar 普通圆形ProgressBar 该类型进度条也就是一个表示运转的过程,例如发送短信,连接网络等等,表示一个过程正在执行中. 一般只要在XML布局中定义就可以了. < ...
- vs2012 Silverlight项目签名报错异常的处理方式
项目刚生成为vs2012,原先的Silverlight项目,点击签名,竟然有问题,给上个截图 悲剧了,没有签名证书,就无法实现自动更新,想着vs2012可能几个更新没有安装吧,但是自己手动下载竟然一两 ...
- Nodepad++ tab改成4个空格
设置-首选项-选项卡设置-使用空格替换