本文整理汇总了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();
}
示例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();
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}