How to disable the reordering of table columns in

2019-06-23 23:37发布

Trying to figure out on how can i disable the reordering of table columns in javafx 2?

2条回答
我只想做你的唯一
2楼-- · 2019-06-23 23:58

After much waste of time, I've found the following, very simple, solution:

TableHeaderRow header = (TableHeaderRow) myTableView.lookup("TableHeaderRow");
header.setMouseTransparent(true);
查看更多
倾城 Initia
3楼-- · 2019-06-24 00:03

Here's the solution:

tblView.getColumns().addListener(new ListChangeListener() {
        @Override
        public void onChanged(Change change) {
          change.next();
          if(change.wasReplaced()) {
              tblView.getColumns().clear();
              tblView.getColumns().addAll(column1,column2...);
          }
        }
    });
查看更多
登录 后发表回答