getChildrenAPI从
Pane,并
getRowIndex(Nodechild)与
getColumnIndex(Node child)来自
GridPane
//Gets the list of children of this Parent. public ObservableList<Node> getChildren() //Returns the child's column index constraint if setpublic static java.lang.Integer getColumnIndex(Node child)//Returns the child's row index constraint if set.public static java.lang.Integer getRowIndex(Node child)
以下是示例代码,可从中获取
Node使用的行和列索引
GridPane
public Node getNodeByRowColumnIndex (final int row, final int column, GridPane gridPane) { Node result = null; ObservableList<Node> childrens = gridPane.getChildren(); for (Node node : childrens) { if(gridPane.getRowIndex(node) == row && gridPane.getColumnIndex(node) == column) { result = node; break; } } return result;}
重要更新:
getRowIndex()和
getColumnIndex()现在是静态方法,应更改为
GridPane.getRowIndex(node)和
GridPane.getColumnIndex(node)。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)