原链接:
https://stackoverflow.com/questions/26563390/detect-doubleclick-on-row-of-tableview-javafx
dataTable.setRowFactory( tv -> {
TableRow<EmailInfo> row = new TableRow<EmailInfo>();
row.setOnMouseClicked(event -> {
if (event.getClickCount() == 2 && (! row.isEmpty()) ) {
EmailInfo emailInfo = row.getItem();
System.out.println(emailInfo);
}
});
return row ;
});
测试结果:
双击该行后,可以正确打印该行EmailInfo信息。
如有错误,欢迎指正
end