inv*_*ant 35
我看不出有任何直接的API来获取由行列索引节点,但可以使用getChildrenAPI从Pane,并getRowIndex(Node child)与getColumnIndex(Node child)来自GridPane
//Gets the list of children of this Parent.
public ObservableList<Node> getChildren()
//Returns the child's column index constraint if set
public static java.lang.Integer getColumnIndex(Node child)
//Returns the child's row index constraint if set.
public static java.lang.Integer getRowIndex(Node child)
Run Code Online (Sandbox Code Playgroud)
以下是从中获取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;
}
Run Code Online (Sandbox Code Playgroud)
重要更新: getRowIndex()和getColumnIndex()现在的静态方法和应改为GridPane.getRowIndex(node)和GridPane.getColumnIndex(node).
| 归档时间: |
|
| 查看次数: |
36545 次 |
| 最近记录: |