有问题! 在javafx表格视图中,我通过Shift + mouseClick或Clt + MouseClick应用了多个选定模式。通过这如何在javafx中获取所有选定的行数据
tblViewCurrentStore.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
tblViewCurrentStore.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
});
它在图形用户界面好,但问题是,如果我用这个代码,它给我的最后选择单元格的值,
private void btnDeleteOnAction(ActionEvent event) {
System.out.println(tblViewCurrentStore.getSelectionModel().getSelectedItem().getProductName().toString());
}
出把
SAMSUNG HDD
但当我使用这个代码它给了这个!
private void btnDeleteOnAction(ActionEvent event) {
System.out.println(tblViewCurrentStore.getSelectionModel().getSelectedItems().toString());
}
它给我这个类型的输出
[[email protected], [email protected], [email protected]]
,但是当我选择多行,然后按删除它会显示像第一个所有选定的数据,我需要。
好了,所以......那么,什么是您所遇到的问题?你既没有提出问题也没有说明问题。 – scottb
当我选择多行然后按删除它将显示所有选定的数据。 我该怎么做? –
我无法理解你的问题。你是否说你想要在点击删除按钮时收集选定行的数组? – scottb