當前位置: 首頁>>代碼示例>>Java>>正文


Java Bounds.contains方法代碼示例

本文整理匯總了Java中javafx.geometry.Bounds.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java Bounds.contains方法的具體用法?Java Bounds.contains怎麽用?Java Bounds.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.geometry.Bounds的用法示例。


在下文中一共展示了Bounds.contains方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getIndexAt

import javafx.geometry.Bounds; //導入方法依賴的package包/類
protected int getIndexAt(ListView<?> listView, Point2D point) {
    if (point == null) {
        return listView.getSelectionModel().getSelectedIndex();
    }
    point = listView.localToScene(point);
    Set<Node> lookupAll = getListCells(listView);
    ListCell<?> selected = null;
    for (Node cellNode : lookupAll) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (ListCell<?>) cellNode;
            break;
        }
    }
    if (selected == null) {
        return -1;
    }
    return selected.getIndex();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:JavaFXElementPropertyAccessor.java

示例2: getRowAt

import javafx.geometry.Bounds; //導入方法依賴的package包/類
public int getRowAt(TreeView<?> treeView, Point2D point) {
    if (point == null) {
        return treeView.getSelectionModel().getSelectedIndex();
    }
    point = treeView.localToScene(point);
    int itemCount = treeView.getExpandedItemCount();
    @SuppressWarnings("rawtypes")
    List<TreeCell> cells = new ArrayList<>();
    for (int i = 0; i < itemCount; i++) {
        cells.add(getCellAt(treeView, i));
    }
    TreeCell<?> selected = null;
    for (Node cellNode : cells) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (TreeCell<?>) cellNode;
            break;
        }
    }
    if (selected == null) {
        return -1;
    }
    return selected.getIndex();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:25,代碼來源:JavaFXElementPropertyAccessor.java

示例3: checkHit

import javafx.geometry.Bounds; //導入方法依賴的package包/類
private void checkHit(Node child, double x, double y, List<Node> hits, String indent) {
    Bounds boundsInParent = child.getBoundsInParent();
    if (boundsInParent.contains(x, y)) {
        hits.add(child);
        if (!(child instanceof Parent)) {
            return;
        }
        ObservableList<Node> childrenUnmodifiable = ((Parent) child).getChildrenUnmodifiable();
        for (Node node : childrenUnmodifiable) {
            checkHit(node, x, y, hits, "    " + indent);
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:FXEventQueueDevice.java

示例4: getTableCellAt

import javafx.geometry.Bounds; //導入方法依賴的package包/類
private TableCell<?, ?> getTableCellAt(TableView<?> tableView, Point2D point) {
    point = tableView.localToScene(point);
    Set<Node> lookupAll = getTableCells(tableView);
    TableCell<?, ?> selected = null;
    for (Node cellNode : lookupAll) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (TableCell<?, ?>) cellNode;
            break;
        }
    }
    return selected;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaFXElementPropertyAccessor.java

示例5: getTreeTableCellAt

import javafx.geometry.Bounds; //導入方法依賴的package包/類
public TreeTableCell<?, ?> getTreeTableCellAt(TreeTableView<?> treeTableView, Point2D point) {
    point = treeTableView.localToScene(point);
    Set<Node> lookupAll = getTreeTableCells(treeTableView);
    TreeTableCell<?, ?> selected = null;
    for (Node cellNode : lookupAll) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (TreeTableCell<?, ?>) cellNode;
            break;
        }
    }
    return selected;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaFXElementPropertyAccessor.java

示例6: positionToButtonIndex

import javafx.geometry.Bounds; //導入方法依賴的package包/類
/**
 * Get the index into the panes children that this node should be inserted to.
 * @param screenX Drop screen x position
 * @param screenY Drop screen y position
 * @param pane The pane of interest.
 * @return The index to insert the button into the panes children.
 */
private int positionToButtonIndex(Pane pane, double screenX, double screenY) {
    int idx = pane.getChildren().size();
    for (Node node: pane.getChildren()) {
        Bounds bounds = node.localToScreen(node.getBoundsInLocal());
        if (bounds.contains(screenX, screenY)) {
            idx = pane.getChildren().indexOf(node);
        }
    }
    return idx;
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:18,代碼來源:DragPaneDecorator.java


注:本文中的javafx.geometry.Bounds.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。