/** * creates empty drawers stack */ public JFXDrawersStack() { final Rectangle clip = new Rectangle(); clip.widthProperty().bind(this.widthProperty()); clip.heightProperty().bind(this.heightProperty()); this.setClip(clip); }
if (!dragDetected && event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 1) { if (!isEmpty) { Color fill = (Color) rectangle.getFill(); colorPicker.setValue(fill); colorPicker.fireEvent(new ActionEvent()); rectangle = new Rectangle(SQUARE_SIZE, SQUARE_SIZE); if (color == null) { rectangle.setFill(Color.WHITE); isEmpty = true; } else { rectangle.setFill(color); rectangle.setStrokeType(StrokeType.INSIDE); rectangle.getStyleClass().add("color-rect"); getChildren().add(rectangle);
private void updateHeaderContainerClip() { final double clipOffset = getClipOffset(); final Side side = getSkinnable().getSide(); double controlPrefWidth = 2 * snapSize(rightControlButton.prefWidth(-1)); // Add the spacer if the control buttons are shown // controlPrefWidth = controlPrefWidth > 0 ? controlPrefWidth + SPACER : controlPrefWidth; measureClosingTabs = true; final double headersPrefWidth = snapSize(headersRegion.prefWidth(-1)); final double headersPrefHeight = snapSize(headersRegion.prefHeight(-1)); measureClosingTabs = false; final double maxWidth = snapSize(getWidth()) - controlPrefWidth - clipOffset; final double clipWidth = headersPrefWidth < maxWidth ? headersPrefWidth : maxWidth; final double clipHeight = headersPrefHeight; clip.setX((side == Side.LEFT || side == Side.BOTTOM) && headersPrefWidth >= maxWidth ? headersPrefWidth - maxWidth : 0); clip.setY(0); clip.setWidth(clipWidth); clip.setHeight(clipHeight); }
public void layoutLines(double x, double y, double w, double h, double controlHeight, double translateY) { this.contentHeight = translateY; clip.setY(-contentHeight); clip.setHeight(controlHeight + contentHeight); focusedLine.resizeRelocate(x, controlHeight, w, focusedLine.prefHeight(-1)); line.resizeRelocate(x, controlHeight, w, line.prefHeight(-1)); promptContainer.resizeRelocate(x, y, w, h); scale.setPivotX(w / 2); }
clip = new Rectangle(0, gap / 2, getWidth(), getHeight() - gap); setClip(clip); } else { clip.setY(gap / 2); clip.setHeight(getHeight() - gap); gapAnimation = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(this.translateYProperty(), playExpandAnimation = false; } else if (selectionChanged) { clip.setY(0); clip.setHeight(getHeight()); gapAnimation = new Timeline( new KeyFrame(Duration.millis(240), new KeyValue(clip.yProperty(), gap / 2, Interpolator.EASE_BOTH), new KeyValue(clip.heightProperty(), getHeight() - gap, Interpolator.EASE_BOTH) )); clip.setY(gap / 2); clip.setHeight(getHeight() - gap); clip.setY(0); clip.setHeight(getHeight()); clip.setX(0); clip.setWidth(getWidth());
private Rectangle buidlRectangle(double stroke) { Rectangle r = new Rectangle(); r.setStrokeType(StrokeType.INSIDE); r.setStrokeWidth(stroke); r.setStroke(Color.RED); r.setFill(Color.TRANSPARENT); return r; }
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 OpenPatricianDialogInputSkin(OpenPatricianDialogInput input) { super(input); textField = new TextField(input.getText()); calculateDimensions(input); input.fontProperty().addListener((observable, oldValue, newValue) -> calculateDimensions(input)); textField.textProperty().bindBidirectional(input.textProperty()); textField.getStyleClass().add("openPatricianDialogInput"); Rectangle background = new Rectangle(); background.setHeight(height.doubleValue()); background.setWidth(width.doubleValue()); background.setFill(Color.rgb(150, 150, 150)); background.heightProperty().bind(height); background.widthProperty().bind(width); StackPane stack = new StackPane(); stack.getChildren().addAll(background, textField); Group group = new Group(stack); group.setManaged(false); getChildren().add(group); }
@PostConstruct private void init() { clip.xProperty().addListener( (observable, oldValue, newValue) -> { slaveClip.setX(newValue.doubleValue()); if (scrolledAllToTheLeft()) { slideLeftAnimation.stop(); clip.yProperty().addListener( (observable, oldValue, newValue) -> slaveClip.setY(newValue.doubleValue())); clip.widthProperty().addListener((observable, oldValue, newValue) -> { slaveClip.setWidth(newValue.doubleValue()); scrollRight.setX(newValue.doubleValue() - scrollRight.getWidth()); }); clip.heightProperty().addListener((observable, oldValue, newValue) -> { slaveClip.setHeight(newValue.doubleValue()); scrollLeft.setHeight(newValue.doubleValue()); scrollRight.setHeight(newValue.doubleValue()); }); resetImage(mapImage, slaveClip.getWidth(), slaveClip.getHeight(), scale.doubleValue()); imgView.setClip(clip); shipCanvas.setClip(slaveClip); scrollLeft.setOnMouseEntered(evt -> { if (scrolledAllToTheRight()&& !getChildren().contains(scrollRight)) { getChildren().add(scrollRight); scrollLeft.setOnMouseExited(evt -> slideLeftAnimation.stop()); scrollRight.setOnMouseEntered(evt -> { if (scrolledAllToTheLeft() && !getChildren().contains(scrollLeft)) {
/** * 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); } }
/** * 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); }
JFXUtil.replaceComponent( chart, chartPane ); Rectangle selectRect = new Rectangle( 0, 0, 0, 0 ); selectRect.setFill( Color.DODGERBLUE ); selectRect.setMouseTransparent( true ); selectRect.setOpacity( 0.3 ); selectRect.setStroke( Color.rgb( 0, 0x29, 0x66 ) ); selectRect.setStrokeType( StrokeType.INSIDE ); selectRect.setStrokeWidth( 3.0 ); StackPane.setAlignment( selectRect, Pos.TOP_LEFT );
public PlaceHolderSkin(PlaceHolder control) { super(control); Rectangle area = new Rectangle(control.getX(), control.getY(), control.getLocalWidth(), control.getLocalHeight()); area.setFill(Color.TRANSPARENT); area.xProperty().bind(control.xProperty()); area.yProperty().bind(control.yProperty()); area.widthProperty().bind(control.widthLocalProperty()); area.heightProperty().bind(control.heightLocalProperty()); Group g = new Group(area); getChildren().add(g); }
/** * Creates the node which will be used to capture mouse events. Events are handed over to * {@link #handleMouseEvent(MouseEvent) handleMouseEvent}. * * @return a {@link Node} */ private Node createMouseNode() { Rectangle mouseNode = new Rectangle(); // make the node transparent and make sure its size does not affect the control's size mouseNode.setFill(Color.TRANSPARENT); mouseNode.setManaged(false); // bind width and height to the control mouseNode.widthProperty().bind(getSkinnable().widthProperty()); mouseNode.heightProperty().bind(getSkinnable().heightProperty()); // let it handle the mouse events if allowed by the user mouseNode.addEventHandler(MouseEvent.ANY, this::handleMouseEvent); mouseNode.mouseTransparentProperty().bind(getSkinnable().selectionMouseTransparentProperty()); return mouseNode; }
public static void startValueSetAnimation(final Pane parent) { final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle(); Insets margin = BorderPane.getMargin(parent); if (margin == null) { margin = new Insets(0); } rectangle.widthProperty().bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight())); rectangle.heightProperty().bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom())); rectangle.setFill(Color.rgb(0, 150, 201)); parent.getChildren().add(rectangle); BoxBlur bb = new BoxBlur(); bb.setWidth(5); bb.setHeight(5); bb.setIterations(3); rectangle.setEffect(bb); FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle); ft.setFromValue(0.2); ft.setToValue(0.8); ft.setCycleCount(2); ft.setAutoReverse(true); ft.play(); ft.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { parent.getChildren().remove(rectangle); } }); }
observable -> show(getSkinnable().getPinnedSide())); Rectangle clip = new Rectangle(); clip.setX(0); clip.setY(0); clip.widthProperty().bind(getSkinnable().widthProperty()); clip.heightProperty().bind(getSkinnable().heightProperty());
private void addTabContentHolder(Tab tab) { // create new content place holder TabContentHolder tabContentHolder = new TabContentHolder(tab); tabContentHolder.setClip(new Rectangle()); tabContentHolders.add(tabContentHolder); // always add tab content holder below its header tabsContainer.getChildren().add(0, tabContentHolder); }