尝试使用行和列索引将子项添加到GridPane。它们出现在gui中,但使用GridPane.getColumnIndex(node)始终返回null。
GridPane grid = new GridPane();
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 20; j++) {
grid.setGridLinesVisible(true);
Button myBtn = new Button("foo");
GridPane.setColumnIndex(myButton,i);
GridPane.setRowIndex(myButton,j);
grid.getChildren().add(myButton);
}
当我尝试使用此算法时,我从javafx GridPane retrive specific Cell content的答案得到,程序崩溃时出现NullPointerException。
private Node getNodeFromGridPane(GridPane gridPane, int col, int row)
{
for (Node node : gridPane.getChildren()) {
if (GridPane.getColumnIndex(node) == col && GridPane.getRowIndex(node) == row) {
return node;
}
}
return null;
}
为什么GridPane.getRowIndex()和GridPane.getColumnIndex()在调用setColumnIndex()和setRowIndex()之后仍然返回null?
答案 0 :(得分:0)
所以看起来如果你运行它,我会看到所有按钮都是红白色或蓝色这是因为它们被发现了
RewriteCond %{QUERY_STRING} targetPCUrl=(.*)$
RewriteRule ^ %1 [R=301,L]