如何获取 JavaFX 的列索引和行索引GridPane
。看下面的代码
Text text1 = new Text("Text 1");
Text text2 = new Text("Text 2");
StackPane root = new StackPane();
GridPane gridPane = new GridPane();
gridPane.add(text1, 0, 0);
gridPane.add(text2, 1, 0);
当鼠标在 text1 上输入时,我想获取 GridPane 的列索引和行索引
text1.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
//want to get column index =0 and row index=0
}
});
请告诉我。