本文整理汇总了Java中javafx.scene.layout.GridPane.getColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.getColumnIndex方法的具体用法?Java GridPane.getColumnIndex怎么用?Java GridPane.getColumnIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.getColumnIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void render(TimeLine timeLine) {
int columnsNumber = getCellNumber(width, SPACING, sideSize);
int rowsNumber = getCellNumber(height, SPACING, sideSize);
int centerColumn = columnsNumber / 2;
int centerRow = rowsNumber / 2;
for (Node node : scene.getChildren()) {
int x = GridPane.getColumnIndex(node);
int y = GridPane.getRowIndex(node);
Rectangle square = (Rectangle) node;
if (timeLine.isAlive(new Point(x - centerColumn, y - centerRow))) {
square.setFill(ALIVE_COLOR);
} else {
square.setFill(DEAD_COLOR);
}
}
}
示例2: getNodeByRowColumnIndex
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private javafx.scene.Node getNodeByRowColumnIndex(final int row, final int column, GridPane gridPane) {
javafx.scene.Node result = null;
ObservableList<javafx.scene.Node> children = gridPane.getChildren();
for (javafx.scene.Node node : children) {
if(GridPane.getRowIndex(node) == row && GridPane.getColumnIndex(node) == column) {
result = node;
break;
}
}
return result;
}
示例3: isOverlapping
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
* Checks if a tile with the given width and height would overlap a pre-existing tile at the point {@code (col, row)},
* ignoring some nodes when calculating collisions. Note that this method does <i>not</i> perform bounds checking;
* use {@link #isOpen(int, int, int, int, Predicate) isOpen} to check if a widget can be placed at that point.
*
* @param col the column index of the point to check
* @param row the row index of the point to check
* @param tileWidth the width of the tile
* @param tileHeight the height of the tile
* @param ignore a predicate to use to ignore nodes when calculating collisions
*/
public boolean isOverlapping(int col, int row, int tileWidth, int tileHeight, Predicate<Node> ignore) {
for (Node child : getChildren()) {
if (ignore.test(child)) {
continue;
}
// All "real" children have a column index, row index, and column and row spans
// Other children (like the grid lines) don't have these properties and will throw null pointers
// when trying to access these properties
if (GridPane.getColumnIndex(child) != null) {
int x = GridPane.getColumnIndex(child);
int y = GridPane.getRowIndex(child);
int width = GridPane.getColumnSpan(child);
int height = GridPane.getRowSpan(child);
if (x + width > col && y + height > row
&& x - tileWidth < col && y - tileHeight < row) {
// There's an intersection
return true;
}
}
}
return false;
}
示例4: getX
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private double getX(javafx.scene.Node node) {
int column = GridPane.getColumnIndex(node);
return (projection.getSideSize() + TwoDimensionalProjection.SPACING) * column;
}