line = new Line(); line.setStroke(getSkinnable().isSelected() ? toggleButton.getToggleLineColor() : toggleButton.getUnToggleLineColor()); line.setStartX(0); line.setStartY(0); line.setEndX(circleRadius * 2 + 2); line.setEndY(0); line.setStrokeWidth(circleRadius * 1.5); line.setStrokeLineCap(StrokeLineCap.ROUND); line.setSmooth(true); .setTarget(line.strokeProperty()) .setEndValueSupplier(() -> getSkinnable().isSelected() ? ((JFXToggleButton) getSkinnable()).getToggleLineColor()
new KeyFrame( Duration.ZERO, new KeyValue(rightLine.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(leftLine.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(box.rotateProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(box.scaleXProperty(), 1, Interpolator.EASE_BOTH), ), new KeyFrame(Duration.millis(400), new KeyValue(rightLine.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(leftLine.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(rightLine.endXProperty(), (boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5, Interpolator.EASE_BOTH), new KeyValue(rightLine.endYProperty(), maxHeight - padding - 2 * lineThick, Interpolator.EASE_BOTH), new KeyValue(leftLine.endXProperty(), (boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5, Interpolator.EASE_BOTH), new KeyValue(leftLine.endYProperty(), maxHeight - padding - 2 * lineThick, Interpolator.EASE_BOTH) new KeyFrame( Duration.millis(800), new KeyValue(rightLine.endXProperty(), boxWidth - padding - labelOffset + lineThick / 2, Interpolator.EASE_BOTH),
rightLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5); rightLine.setStartY(maxHeight - padding - lineThick); rightLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5); rightLine.setEndY(maxHeight - padding - lineThick); leftLine.setStartX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5); leftLine.setStartY(maxHeight - padding - lineThick); leftLine.setEndX((boxWidth + padding - labelOffset) / 2 - boxWidth / 5.5); leftLine.setEndY(maxHeight - padding - lineThick); transition = new CheckBoxTransition(); if (getSkinnable().isSelected()) {
rippler.setRipplerFill(getSkinnable().isSelected() ? control.getUnCheckedColor() : control.getCheckedColor()); rightLine = new Line(); leftLine = new Line(); rightLine.setStroke(control.getCheckedColor()); rightLine.setStrokeWidth(lineThick); leftLine.setStroke(control.getCheckedColor()); leftLine.setStrokeWidth(lineThick); rightLine.setVisible(false); leftLine.setVisible(false);
Line line = new Line(shift, 0, contentCircleRadius, 0); line.fillProperty().bind(timePicker.defaultColorProperty()); line.strokeProperty().bind(line.fillProperty()); line.setStrokeWidth(1.5); minsPointer.getChildren().addAll(line, selectionCircle, minCircle); StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT);
private Node createCloseIcon() { Group group = new Group(); group.getStyleClass().add("graphics"); //$NON-NLS-1$ Circle circle = new Circle(); circle.getStyleClass().add("circle"); //$NON-NLS-1$ circle.setRadius(6); circle.setCenterX(6); circle.setCenterY(6); group.getChildren().add(circle); Line line1 = new Line(); line1.getStyleClass().add("line"); //$NON-NLS-1$ line1.setStartX(4); line1.setStartY(4); line1.setEndX(8); line1.setEndY(8); group.getChildren().add(line1); Line line2 = new Line(); line2.getStyleClass().add("line"); //$NON-NLS-1$ line2.setStartX(8); line2.setStartY(4); line2.setEndX(4); line2.setEndY(8); group.getChildren().add(line2); return group; }
public CapacitorSymbol(Color stroke, double strokeWidth, double size) { setPrefSize(size, size); l1 = new Line(); l1.setStroke(stroke); l1.setStrokeWidth(strokeWidth); l2 = new Line(); l2.setStroke(stroke); l2.setStrokeWidth(strokeWidth); l3 = new Line(); l3.setStroke(stroke); l3.setStrokeWidth(strokeWidth); l4 = new Line(); l4.setStroke(stroke); l4.setStrokeWidth(strokeWidth); getChildren().addAll(l1, l2, l3, l4); }
@Override public void attach(Pane node, TextNode textNode) { Line l = (Line) textNode.getUserData(); if( l == null ) { l = new Line(); l.setMouseTransparent(true); l.setManaged(false); l.setStartY(textNode.getBoundsInLocal().getHeight() - 2); l.strokeProperty().bind(textNode.fillProperty()); l.setEndY(textNode.getBoundsInLocal().getHeight() - 2 ); l.setEndX(textNode.getBoundsInLocal().getWidth()); //l.setTranslateY(textNode.getBaselineOffset() + 2.0); textNode.setUserData(l); } node.getChildren().add(l); }
@Override public void handle(MouseEvent event) { Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY()); Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY()); Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal()); valueMarker.setStartY(0); valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY()); valueMarker.setStartX(0); valueMarker.setEndX(0); valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2); double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY(); valueMarker.setTranslateY(-ydelta * 2); } });
public SwitchSymbol(Color stroke, double strokeWidth, double size) { setPrefSize(size, size); leg1 = new Line(); leg1.setFill(stroke); leg1.setStroke(stroke); leg1.setStrokeWidth(strokeWidth); leg2 = new Line(); leg2.setFill(stroke); leg2.setStroke(stroke); leg2.setStrokeWidth(strokeWidth); box = new Rectangle(); box.setFill(Color.TRANSPARENT); box.setStroke(stroke); box.setStrokeWidth(strokeWidth); getChildren().addAll(leg1, leg2, box); }
@Override public void attach(StyledTextNode node, Text textNode) { Line l = (Line) textNode.getUserData(); if( l == null ) { l = new Line(); l.setManaged(false); l.setEndX(textNode.getBoundsInLocal().getWidth()); l.setTranslateY(textNode.getBaselineOffset() + 2.0); textNode.setUserData(l); } node.getChildren().add(l); }
stack.getChildren().addAll(splitPane1, glassPane); Scene scene = new Scene(stack, 800, 600); LV1.endYProperty().bind(scene.heightProperty()); stage.setScene(scene); pane1.setOnMouseMoved(mouseHandler); boolean setCrosshair = false; if (x > min && x < min + xAxis.getWidth()) { LV1.setStartX(x); LV1.setEndX(x); setCrosshair = true; } else if (x <= min){ LV1.setStartX(min); LV1.setEndX(min); } else if (x >= max){ LV1.setStartX(max); LV1.setEndX(max);
animationPane.getChildren().add(adapterText); Line lineInput = new Line(); lineInput.getStrokeDashArray().addAll(5d); lineInput.setCache(true); lineInput.startXProperty().set(getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 8); lineInput.endXProperty().set(lineInput.startXProperty().get()); lineInput.startYProperty().set(0); lineInput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineInput); Line lineOutput = new Line(); lineOutput.getStrokeDashArray().addAll(5d); lineOutput.setCache(true); lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8); lineOutput.endXProperty().set(lineOutput.startXProperty().get()); lineOutput.startYProperty().set(0); lineOutput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineOutput);
Line line = new Line(0, radius, destinationWidth, radius); line.setStrokeWidth(10); line.setRotate(angle/2);
this.selectionMarker.setManaged(false); this.selectionMarker.getStyleClass().add("selection-marker"); //$NON-NLS-1$ this.caret.setVisible(false); this.caret.setStrokeWidth(2); this.caret.setManaged(false); this.caret.getStyleClass().add("text-caret"); //$NON-NLS-1$ StyledTextLayoutContainer.this.caret.setVisible(false); } else { StyledTextLayoutContainer.this.caret.setVisible(StyledTextLayoutContainer.this.caretIndex != -1); StyledTextLayoutContainer.this.caret.setVisible(false); }; ownerFocusedProperty.addListener( o -> { if( ! ownerFocusedProperty.get() ) { this.caret.setVisible(false);
public static void addMarker(final XYChart<?, ?> chart, final StackPane chartWrap) { final Line valueMarker = new Line(); final Node chartArea = chart.lookup(".chart-plot-background"); chartArea.setOnMouseMoved(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY()); Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY()); Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal()); valueMarker.setStartY(0); valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY()); valueMarker.setStartX(0); valueMarker.setEndX(0); valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2); double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY(); valueMarker.setTranslateY(-ydelta * 2); } }); chartWrap.getChildren().add(valueMarker); }
public CaretLayer() { this.caret.setVisible(false); this.caret.setStrokeWidth(2); this.caret.getStyleClass().add("text-caret"); //$NON-NLS-1$ this.caret.setVisible(false); this.getChildren().add(this.caret); this.caretAnimation = createCaretAnimation(this.caret); this.sceneProperty().addListener((x, o, n)->{ if (n == null) { if (this.caretAnimation != null) { this.caretAnimation.stop(); } this.caretAnimation = null; } else { this.caretAnimation = createCaretAnimation(this.caret); } }); }
@Override public void layout(StyledTextNode node, Text textNode) { Line l = (Line) textNode.getUserData(); if( l != null ) { l.setEndX(node.getWidth()); } }
@Override protected void handleControlPropertyChanged(String p) { if ("TOGGLE_COLOR".equals(p)) { if (getSkinnable().isSelected()) { circle.setFill(((JFXToggleButton) getSkinnable()).getToggleColor()); } } else if ("UNTOGGLE_COLOR".equals(p)) { if (!getSkinnable().isSelected()) { circle.setFill(((JFXToggleButton) getSkinnable()).getUnToggleColor()); } } else if ("TOGGLE_LINE_COLOR".equals(p)) { if (getSkinnable().isSelected()) { line.setStroke(((JFXToggleButton) getSkinnable()).getToggleLineColor()); } } else if ("UNTOGGLE_LINE_COLOR".equals(p)) { if (!getSkinnable().isSelected()) { line.setStroke(((JFXToggleButton) getSkinnable()).getUnToggleLineColor()); } } else { super.handleControlPropertyChanged(p); } }