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?的更多相关文章

  1. javafx将数据库内容输出到tableview表格

    一 .创建Fxml文件,用Javafx Scene Builder 编辑页面,创建tableview(表格)和tablecolum(表格中的列),并为其设置fxid: 二.生成fxml文件的控制类: ...

  2. javafx基于使用fxml布局的tableview数据绑定用法

    来个简单明了的 fxml的tableview数据绑定和java代码方式的数据绑定很像,不同的在于要有一到映射 首先看个目录 1.界面文件Sample.fxml <?xml version=&qu ...

  3. iOS UITableView ExpandableHeader(可形变的Header)

    最常见的header就是在tableView下拉时header里的图片会放大的那种, 最近研究了一下,自己实现了这种header. 1.设置TableView的contentInset(为header ...

  4. JavaScript资源大全中文版(Awesome最新版)

    Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...

  5. python解析git log后生成页面显示git更新日志信息

    使用git log可以查到git上项目的更新日志. 如下两个git项目,我想把git的日志信息解析成一个便于在浏览器上查看的页面. https://github.com/gityf/lua https ...

  6. 知问前端——Ajax提交表单

    本文,运用两大表单插件,完成数据表新增的工作. 一.创建数据库 创建一个数据库,名称为:zhiwen,表——user表,字段依次为:id.name.pass.email.sex.birthday.da ...

  7. wesome-android

    awesome-android Introduction android libs from github System requirements Android Notice If the lib ...

  8. Github上有趣的资料 | JS

    留着,以后用得着,原文地址:http://www.jianshu.com/p/7c9aa9508641 collection AlloyImage 基于HTML5的专业级图像处理开源引擎.An ima ...

  9. UITableView的创建及其一些常用方法

    UITableView,它的数据源继承于UITableViewDataSource,它的委托UITableViewDelegate. 一.UITableView的创建 1.代码方式: UITableV ...

随机推荐

  1. win7 64位系统 Oracle32bit + PL/SQL访问Orale服务,Oracle 11g的安装,中文乱码问题的解决

    前几天装了个Oracle32bit客户端 + PL/SQL连接不上oracle,我安装完打开PL/SQL登录界面跟正常的界面不一样,没有那个连接为Normal.SYSDBA的选项,下面有解释,至于我为 ...

  2. Oracle数据库之一

    数据库(oracle) SQL --结构化查询语言,所有数据库基本通用 数据库是数据的仓库,用于存储数据. 内存.文件和数据库区别 内存中的数据是非持久的,关机之后就会消失. 文件和数据库中的数据都是 ...

  3. core--线程状态

    线程的状态在我看来就只有两种:1运行,2休眠.这两种状态的切换是如何实现的呢? Sleep(毫秒) CreateThread时传入CREATE_SUSPENDED标识 SuspendThread(ha ...

  4. POJ 1458 最长公共子序列

    子序列就是子序列中的元素是母序列的子集,且子序列中元素的相对顺序和母序列相同. 题目要求便是寻找两个字符串的最长公共子序列. dp[i][j]表示字符串s1左i个字符和s2左j个字符的公共子序列的最大 ...

  5. HDU 3555 Bomb (数位DP-记忆化搜索模板)

    题意 求区间[1,n]内含有相邻49的数. 思路 比较简单的按位DP思路.这是第一次学习记忆化搜索式的数位DP,确实比递推形式的更好理解呐,而且也更通用~可以一般化: [数位DP模板总结] int d ...

  6. Mysql事物与Metadata lock 问题

    环境说明:     MySQL 5.6.16     OS:Linux RedHat 6.2 64bit 1.问题描述 目前新上一个使用MySQL数据库项目,在数据库中,每隔5分钟做truncate某 ...

  7. ANDROID5.0触摸屏校准

    1.校准原理: 1)首先生成校准用的参数,可以适用tslib生成校准参数,也可以使用校准app生成:使用校准app进行校准对使用者要求比较低,使用者可以不用学习复杂的命令:本文使用app方式 2)生成 ...

  8. 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:4.安装Oracle RAC FAQ-4.5.安装Grid,创建ASM磁盘组空间不足

    因之前分区时,分区的Last cylinder的值选了“1”,导致创建磁盘组空间不足.解决办法是先删除分区,重新创建分区并删除ASM磁盘,然后重建ASM磁盘 1. 先删除分区,重新创建分区: 1)查询 ...

  9. SVN 命令行 精编版

    1.将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:svn checkout https://svn.sinaapp.com/beckhom 简 ...

  10. LruCache--远程图片获取与本地缓存

    Class Overview A cache that holds strong references to a limited number of values. Each time a value ...