当前位置: 首页>>代码示例>>Java>>正文


Java GridPane.getColumnIndex方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:20,代码来源:TwoDimensionalProjection.java

示例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;
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:14,代码来源:TwoDimensionalProjectionTest.java

示例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;
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:34,代码来源:TilePane.java

示例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;
}
 
开发者ID:slemonide,项目名称:GraphSpace,代码行数:5,代码来源:TwoDimensionalProjectionTest.java


注:本文中的javafx.scene.layout.GridPane.getColumnIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。