@Override public void init() { nextPage.setOpacity(0); wizard.getChildren().add(tempPage); wizard.getChildren().add(nextPage); newX = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinX(); newY = colorPane1.localToScene(colorPane1.getBoundsInLocal()).getMinY(); tempPage.getChildren().add(colorPane1); colorPane1.setTranslateX(newX); colorPane1.setTranslateY(newY); }
OverLayRipple() { super(); setOverLayBounds(this); this.getStyleClass().add("jfx-rippler-overlay"); // update initial position if(JFXRippler.this.getChildrenUnmodifiable().contains(control)) { double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX()); double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); Bounds bounds = control.getBoundsInParent(); this.setX(bounds.getMinX() + diffMinX - snappedLeftInset()); this.setY(bounds.getMinY() + diffMinY - snappedTopInset()); } // set initial attributes setOpacity(0); setCache(true); setCacheHint(CacheHint.SPEED); setCacheShape(true); setManaged(false); } }
double startX = maxX - width; rectBounds.add(new BoundingBox(textBounds.getMinX() + startX, textBounds.getMinY() + startY, width, temp.getLayoutBounds().getHeight()));
rect.fillProperty().bind(paintProperty()); rect.setManaged(false); rect.setX(boundingBox.getMinX()); rect.setY(boundingBox.getMinY()); rect.setWidth(boundingBox.getWidth());
private void showAutocompletePopup(int insertionIndex, String input) { CompletionResultSource suggestionMaker = mySuggestionProvider.get(); List<MenuItem> suggestions = suggestionMaker.getSortedMatches(input, 5) .map(result -> { Label entryLabel = new Label(); entryLabel.setGraphic(result.getTextFlow()); entryLabel.setPrefHeight(5); CustomMenuItem item = new CustomMenuItem(entryLabel, true); item.setUserData(result); item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName())); return item; }) .collect(Collectors.toList()); autoCompletePopup.getItems().setAll(suggestions); myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length()) .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY())); Skin<?> skin = autoCompletePopup.getSkin(); if (skin != null) { Node fstItem = skin.getNode().lookup(".menu-item"); if (fstItem != null) { fstItem.requestFocus(); } } }
double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX()); double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX()); switch (getMaskType()) { case RECT: mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth, case CIRCLE: double radius = Math.min((width / 2) - 2 * borderWidth, (height / 2) - 2 * borderWidth); mask = new Circle((bounds.getMinX() + diffMinX + bounds.getMaxX() - diffMaxX) / 2 - snappedLeftInset(), (bounds.getMinY() + diffMinY + bounds.getMaxY() - diffMaxY) / 2 - snappedTopInset(), radius, mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY); break; default: mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth,
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); if (invalid) { updateSelectionBackground(); invalid = false; } rippler.resizeRelocate( getSkinnable().getLayoutBounds().getMinX(), getSkinnable().getLayoutBounds().getMinY(), getSkinnable().getWidth(), getSkinnable().getHeight()); }
zoomPane.setClip(new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()));
private void setFocusedSquare(ColorSquare square) { hoverSquare.setVisible(square != null); if (square == focusedSquare) { return; } focusedSquare = square; hoverSquare.setVisible(focusedSquare != null); if (focusedSquare == null) { return; } if (!focusedSquare.isFocused()) { focusedSquare.requestFocus(); } hoverSquare.rectangle.setFill(focusedSquare.rectangle.getFill()); Bounds b = square.localToScene(square.getLayoutBounds()); double x = b.getMinX(); double y = b.getMinY(); double xAdjust; double scaleAdjust = hoverSquare.getScaleX() == 1.0 ? 0 : hoverSquare.getWidth() / 4.0; if (colorPicker.getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) { x = focusedSquare.getLayoutX(); xAdjust = -focusedSquare.getWidth() + scaleAdjust; } else { xAdjust = focusedSquare.getWidth() / 2.0 + scaleAdjust; } hoverSquare.setLayoutX(snapPosition(x) - xAdjust); hoverSquare.setLayoutY(snapPosition(y) - focusedSquare.getHeight() / 2.0 + (hoverSquare.getScaleY() == 1.0 ? 0 : focusedSquare .getHeight() / 4.0)); }
private void displayLabelForData(XYChart.Data<String, Number> data) { final Node node = data.getNode(); final Text dataText = new Text(data.getYValue() + ""); node.parentProperty().addListener(new ChangeListener<Parent>() { @Override public void changed(ObservableValue<? extends Parent> ov, Parent oldParent, Parent parent) { Group parentGroup = (Group) parent; parentGroup.getChildren().add(dataText); } }); node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds) { dataText.setLayoutX( Math.round( bounds.getMinX() + bounds.getWidth() / 2 - dataText.prefWidth(-1) / 2 ) ); dataText.setLayoutY( Math.round( bounds.getMinY() - dataText.prefHeight(-1) * 0.5 ) ); } }); }
getSkinnable().getLayoutBounds().getMinX(), getSkinnable().getLayoutBounds().getMinY(), getSkinnable().getWidth(), getSkinnable().getHeight());
double dx = (x - (bounds.getWidth()/2 + bounds.getMinX())); double dy = (y - (bounds.getHeight()/2 + bounds.getMinY()));
valueMarker.setStartX(chartAreaBounds.getMinX()); valueMarker.setEndX(chartAreaBounds.getMaxX()); updateMarker();
pause.setOnFinished(e -> { Node theTab = tabPane.lookup("#myTab"); // contextMenu.show(theTab, Side.RIGHT, 0, 0); Bounds tabBounds = theTab.getBoundsInLocal(); double centerX = tabBounds.getMinX() + tabBounds.getWidth()/2; double centerY = tabBounds.getMinY()+tabBounds.getHeight()/2; Point2D location = theTab.localToScreen(centerX, centerY); double x = location.getX(); double y = location.getY(); Event event = new ContextMenuEvent(ContextMenuEvent.CONTEXT_MENU_REQUESTED, centerX, centerY, x, y, false, new PickResult(theTab, x, y)); Event.fireEvent(theTab, event); });
Bounds locBounds = cuboid.getBoundsInLocal(); List<Point3D> normals=Arrays.asList(new Point3D(-1,0,0),new Point3D(1,0,0), new Point3D(0,-1,0), new Point3D(0,1,0), new Point3D(0,0,-1), new Point3D(0,0,1)); List<Point3D> positions=Arrays.asList(new Point3D(locBounds.getMinX(),0,0), new Point3D(locBounds.getMaxX(),0,0), new Point3D(0,locBounds.getMinY(),0), new Point3D(0,locBounds.getMaxY(),0), new Point3D(0,0,locBounds.getMinZ()), new Point3D(0,0,locBounds.getMaxZ()));
private static Bounds extendLeft(Bounds b, double w) { if(w == 0) { return b; } else { return new BoundingBox( b.getMinX() - w, b.getMinY(), b.getWidth() + w, b.getHeight()); } }
/** * * @param node * @return The X screen coordinate of the node. */ static public double screenX(Node node) { return node.localToScene(node.getBoundsInLocal()).getMinX() + node.getScene().getX() + node.getScene().getWindow().getX(); }
@Override public RNode<T> dragBy(Duration d, double dx, double dy) { Bounds bounds = node.localToScreen(node.getBoundsInLocal()); controller.run(Drag.by(d, bounds.getMinX() + bounds.getWidth() / 2, bounds.getMinY() + bounds.getHeight() / 2, dx, dy)); return this; }
public void setPosition(Point3DReadOnly position) { positionDecoupled.set(position); Bounds boundsInLocal = text3dMesh.getBoundsInLocal(); text3dMesh.setTranslateX(((boundsInLocal.getMinX() - boundsInLocal.getMaxX()) / 2.0) - boundsInLocal.getMinX() + positionDecoupled.getX()); text3dMesh.setTranslateY(((boundsInLocal.getMaxY() - boundsInLocal.getMinY()) / 2.0) - boundsInLocal.getMaxY() + positionDecoupled.getY()); text3dMesh.setTranslateZ(((boundsInLocal.getMinZ() - boundsInLocal.getMaxZ()) / 2.0) - boundsInLocal.getMinZ() + positionDecoupled.getZ()); }
@Override protected void layoutChildren() { super.layoutChildren(); calculateLayout(true, getLayoutBounds().getMinX(), getLayoutBounds().getMinY(), getLayoutBounds().getWidth(), getLayoutBounds().getHeight(), true); }