我在我的TableView中有一个ComboBoxTableCell,当有人单击ComboBoxTableCell时,我希望另一个窗格显示在具有项目列表的ComboBoxTableCell下面。我试图获得ComboBoxTableCell的坐标,但没有运气。有什么方法可以获得坐标吗?或者你有更好的方法来做到这一点?下面是示例UI的图像,我想要完成。谢谢。如何获取TableView JavaFX中TableCell的X和Y坐标?
这里是我的方法来初始化的TableView
私人无效initOrderTable(){
this.orderTable.setEditable(true);
TableColumn nameCol = new TableColumn("Name");
nameCol.setMinWidth(100);
nameCol.setCellValueFactory(
new PropertyValueFactory<>("name"));
nameCol.setCellFactory(new Callback<TableColumn<Product, String>,ComboBoxTableCell<Product,String>>() {
@Override
public ComboBoxTableCell<Product, String> call(TableColumn<Product, String> param) {
ComboBoxTableCell ct= new ComboBoxTableCell<>();
ct.setComboBoxEditable(true);
return ct;
}
});
this.orderTable.getItems().addAll("Sample Row");
this.orderTable.getColumns().addAll(nameCol);
}
你能显示一些代码吗? – 2014-11-22 13:55:19