4
如何在javafx的gridpane中獲取列索引和行索引。見下文如何在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);
代碼當鼠標進入在文本1我想GridPane
的列索引和行索引text1.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
//want to get column index =0 and row index=0
}
});
請讓我知道。
我可以得到指數沒有得到添加任何節點上的網格窗格 –