TableRow
通过TableView的setRowFactory,对行的双击进行操作
- tableView.setRowFactory(new Callback<TableView<T>, TableRow<T>>() {
- @Override
- public TableRow<T> call(TableView<T> param) {
- return new TableRowControl();
- }
- });
- class TableRowControl extends TableRow<T> {
- public TableRowControl() {
- super();
- this.setOnMouseClicked(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- if (event.getButton().equals(MouseButton.PRIMARY)
- && event.getClickCount() == 2
- && TableRowControl.this.getIndex() < tableView.getItems().size()) {
- //doSomething
- }
- }
- });
- }
- }