當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。