clip.setArcHeight(180); imageView.setClip(clip);
/** * Builds a clip-ready rounded corners {@link Rectangle} that is square. * * @param side The size of the size of this square * @param roundedRadius The radius of this square's corners rounding * * @return A square with the given side size and rounded corners with the given radius */ public static Rectangle getSquareClip(final double side, final double roundedRadius) { final Rectangle rectangle = new Rectangle(); rectangle.setHeight(side); rectangle.setWidth(side); rectangle.setArcWidth(roundedRadius); rectangle.setArcHeight(roundedRadius); return rectangle; }
public DragButton(@Nonnull String text) { setCursor(Cursor.W_RESIZE); rectangle = new Rectangle(); rectangle.setFill(Color.GRAY); rectangle.setArcHeight(5.0); rectangle.setArcWidth(5.0); line = new Line(); label = Components.label(text); label.setTextFill(Color.WHITE); getChildren().addAll(rectangle, line, label); }
public BadgeCount(int count) { text = new Text(Integer.toString(count)); text.setStyle("-fx-fill: white"); double height = text.getBoundsInLocal().getHeight(); double width = Math.max(text.getBoundsInLocal().getWidth(), height); double x = getLayoutX() + getWidth() / 2; double y = getLayoutY() + getHeight() / 2; r1 = new Rectangle(x, y, width * 1.3, height * 1.3); r1.setFill(Color.WHITE); r1.setArcHeight(15); r1.setArcWidth(15); r2 = new Rectangle(x, y, width * 1.2, height * 1.2); r2.setFill(Color.RED); r2.setArcHeight(15); r2.setArcWidth(15); getChildren().addAll(r1, r2, text); }
@Override public Node createVisualRepresentation() { Pane pane = new Pane(); final Rectangle adapterRectangle = new Rectangle(ADAPTER_WIDTH, ADAPTER_HEIGHT); adapterRectangle.setFill(ADAPTER_COLOR); adapterRectangle.setArcHeight(25); adapterRectangle.setArcWidth(25); final Text adapterText = new Text(id); adapterText.setFontSmoothingType(FontSmoothingType.LCD); adapterText.setX(adapterRectangle.getWidth() / 2-adapterText.getBoundsInLocal().getWidth() / 2); adapterText.setY(-5); pane.getChildren().add(adapterRectangle); pane.getChildren().add(adapterText); return pane; }
rectangle.setArcHeight(4); rectangle.setArcWidth(6); rectangle.setEffect(new DropShadow());
@Override public Node createVisualRepresentation() { Pane pane = new Pane(); final Rectangle rectangle = new Rectangle(EVENT_WIDTH, EVENT_HEIGHT); rectangle.setFill(color); rectangle.setArcHeight(20); rectangle.setArcWidth(20); final Text text = new Text(getDisplayText()); text.setFontSmoothingType(FontSmoothingType.LCD); final double textWidth = text.getBoundsInLocal().getWidth(); final double testHeight = text.getBoundsInLocal().getHeight(); text.setX((rectangle.getWidth() / 2)-textWidth / 2); text.setY(rectangle.getHeight() / 2+testHeight / 4); pane.getChildren().add(rectangle); pane.getChildren().add(text); return pane; }
@Override public Node createVisualRepresentation() { Pane pane = new Pane(); final Rectangle workflowRectangle = new Rectangle(WIDTH + 20, EventAnimationBase.EVENT_HEIGHT + 15); workflowRectangle.setFill(WORKFLOW_COLOR); workflowRectangle.setArcHeight(25); workflowRectangle.setArcWidth(25); final Text classText = new Text(workflowClass); classText.setFontSmoothingType(FontSmoothingType.LCD); classText.setX(workflowRectangle.getWidth() / 2-classText.getBoundsInLocal().getWidth() / 2); classText.setY(-16); final Text instanceIdText = new Text(id); instanceIdText.setFont(Font.font(Font.getDefault().getName(), 10)); instanceIdText.setFontSmoothingType(FontSmoothingType.LCD); instanceIdText.setX(workflowRectangle.getWidth() / 2-classText.getBoundsInLocal().getWidth() / 2); instanceIdText.setY(-3); pane.getChildren().add(workflowRectangle); pane.getChildren().add(classText); pane.getChildren().add(instanceIdText); return pane; }
/** * Compute the needed clip for stage's shadow border * * @param newBounds * @param shadowVisible */ void setShadowClip(Bounds newBounds) { external.relocate(newBounds.getMinX() - SHADOW_WIDTH, newBounds.getMinY() - SHADOW_WIDTH); internal.setX(SHADOW_WIDTH); internal.setY(SHADOW_WIDTH); internal.setWidth(newBounds.getWidth()); internal.setHeight(newBounds.getHeight()); internal.setArcWidth(shadowRectangle.getArcWidth()); // shadowRectangle // CSS cannot be // applied on // this internal.setArcHeight(shadowRectangle.getArcHeight()); external.setWidth(newBounds.getWidth() + SHADOW_WIDTH * 2); external.setHeight(newBounds.getHeight() + SHADOW_WIDTH * 2); Shape clip = Shape.subtract(external, internal); shadowRectangle.setClip(clip); }
/** * Prepare Stage for dock feedback display */ void buildDockFeedbackStage() { dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT); dockFeedback = new Rectangle(0, 0, 100, 100); dockFeedback.setArcHeight(10); dockFeedback.setArcWidth(10); dockFeedback.setFill(Color.TRANSPARENT); dockFeedback.setStroke(Color.BLACK); dockFeedback.setStrokeWidth(2); dockFeedback.setCache(true); dockFeedback.setCacheHint(CacheHint.SPEED); dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3)); dockFeedback.setMouseTransparent(true); BorderPane borderpane = new BorderPane(); borderpane.setStyle("-fx-background-color:transparent"); // J8 borderpane.setCenter(dockFeedback); Scene scene = new Scene(borderpane); scene.setFill(Color.TRANSPARENT); dockFeedbackPopup.setScene(scene); dockFeedbackPopup.sizeToScene(); }
PressAnyKeyState() { getInput().addEventHandler(KeyEvent.KEY_PRESSED, e -> { if (Input.isIllegal(e.getCode())) return; boolean rebound = FXGL.getInput().rebind(actionContext, e.getCode(), InputModifier.from(e)); if (rebound) FXGL.getStateMachine().popState(); }); getInput().addEventHandler(MouseEvent.MOUSE_PRESSED, e -> { boolean rebound = FXGL.getInput().rebind(actionContext, e.getButton(), InputModifier.from(e)); if (rebound) FXGL.getStateMachine().popState(); }); Rectangle rect = new Rectangle(250, 100); rect.setStroke(Color.color(0.85, 0.9, 0.9, 0.95)); rect.setStrokeWidth(10); rect.setArcWidth(15); rect.setArcHeight(15); Text text = getUIFactory().newText(getLocalizedString("menu.pressAnyKey"), 24); StackPane pane = new StackPane(rect, text); pane.setTranslateX(FXGL.getAppWidth() / 2 - 125); pane.setTranslateY(FXGL.getAppHeight() / 2 - 50); getChildren().add(pane); } }
bg.setStrokeWidth(4); bg.setArcWidth(25); bg.setArcHeight(25);
trace.setArcHeight(innerBar.getArcHeight()); trace.setTranslateX(innerBar.getWidth() < newWidth ? innerBar.getWidth() : newWidth); trace.setTranslateY(3);
trace.setArcHeight(innerBar.getArcHeight()); trace.setTranslateX(innerBar.getWidth() < newWidth ? innerBar.getWidth() : newWidth); trace.setTranslateY(3);
_rect.setArcHeight( theTextBorderArc ); _rect.setStrokeWidth( theTextBorderSize ); _rect.setWidth( _textNode.getBoundsInLocal().getWidth() + theLeftTextPadding + theRightTextPadding );