@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) { // handle any data already in series for (int j = 0; j < series.getData().size(); j++) { Data item = series.getData().get(j); Node candle = createCandle(seriesIndex, item, j); if (shouldAnimate()) { candle.setOpacity(0); getPlotChildren().add(candle); // fade in new candle FadeTransition ft = new FadeTransition(Duration.millis(500), candle); ft.setToValue(1); ft.play(); } else { getPlotChildren().add(candle); } } // create series path Path seriesPath = new Path(); seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex); series.setNode(seriesPath); getPlotChildren().add(seriesPath); }
public static Node createIconContent() { Path path = new Path(); path.getElements().addAll( new MoveTo(25, 25), new HLineTo(45), new ArcTo(20, 20, 0, 80, 25, true, true) ); path.setStroke(Color.web("#b9c0c5")); path.setStrokeWidth(5); path.getStrokeDashArray().addAll(15d,15d); path.setFill(null); javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow(); effect.setOffsetX(1); effect.setOffsetY(1); effect.setRadius(3); effect.setColor(Color.rgb(0,0,0,0.6)); path.setEffect(effect); return path; }
@Override protected void seriesChanged(Change<? extends MultiAxisChart.Series<X, Y>> c) { // Update style classes for all series lines and symbols // Note: is there a more efficient way of doing this? for (int i = 0; i < getDataSize(); i++) { final MultiAxisChart.Series<X, Y> s = getData().get(i); Path seriesLine = (Path) ((Group) s.getNode()).getChildren().get(1); Path fillPath = (Path) ((Group) s.getNode()).getChildren().get(0); seriesLine.getStyleClass().setAll("chart-series-area-line", "series" + i, s.defaultColorStyleClass); fillPath.getStyleClass().setAll("chart-series-area-fill", "series" + i, s.defaultColorStyleClass); for (int j = 0; j < s.getData().size(); j++) { final Data<X, Y> item = s.getData().get(j); final Node node = item.getNode(); if (node != null) node.getStyleClass().setAll("chart-area-symbol", "series" + i, "data" + j, s.defaultColorStyleClass); } } }
private void updateDefaultColorIndex(final MultiAxisChart.Series<X, Y> series) { int clearIndex = seriesColorMap.get(series); Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1); Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0); if (seriesLine != null) { seriesLine.getStyleClass().remove(DEFAULT_COLOR + clearIndex); } if (fillPath != null) { fillPath.getStyleClass().remove(DEFAULT_COLOR + clearIndex); } for (int j = 0; j < series.getData().size(); j++) { final Node node = series.getData().get(j).getNode(); if (node != null) { node.getStyleClass().remove(DEFAULT_COLOR + clearIndex); } } }
public void bindToColor(final ObjectProperty<Color> color, final ObjectProperty<Color.Intensity> intensity, final boolean doColorBackground) { final BiConsumer<Color, Color.Intensity> recolor = (newColor, newIntensity) -> { final JFXTextField textField = (JFXTextField) lookup("#textField"); textField.setUnFocusColor(TRANSPARENT); textField.setFocusColor(newColor.getColor(newIntensity)); if (doColorBackground) { final Path shape = (Path) lookup("#shape"); shape.setFill(newColor.getColor(newIntensity.next(-1))); shape.setStroke(newColor.getColor(newIntensity.next(-1).next(2))); textField.setStyle("-fx-prompt-text-fill: rgba(255, 255, 255, 0.6); -fx-text-fill: " + newColor.getTextColorRgbaString(newIntensity) + ";"); textField.setFocusColor(newColor.getTextColor(newIntensity)); } else { textField.setStyle("-fx-prompt-text-fill: rgba(0, 0, 0, 0.6);"); } }; color.addListener(observable -> recolor.accept(color.get(), intensity.get())); intensity.addListener(observable -> recolor.accept(color.get(), intensity.get())); recolor.accept(color.get(), intensity.get()); }
private Path initializeTriangle() { final Path triangle = new Path(); MoveTo start = new MoveTo(); LineTo l1 = new LineTo(); LineTo l2 = new LineTo(); LineTo l3 = new LineTo(); start.xProperty().bind(ax); start.yProperty().bind(ay); l1.xProperty().bind(bx); l1.yProperty().bind(by); l2.xProperty().bind(cx); l2.yProperty().bind(cy); l3.xProperty().bind(ax); l3.yProperty().bind(ay); triangle.setFill(Color.BLACK); triangle.getElements().addAll(start, l1, l2, l3); return triangle; }
private Path initializeHalfCircle() { final Path halfCircle = new Path(); halfCircle.setStroke(Color.BLACK); MoveTo p1 = new MoveTo(); ArcTo p2 = new ArcTo(); p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS)); p1.yProperty().bind(yProperty()); p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS)); p2.yProperty().bind(yProperty()); p2.setRadiusX(CIRCLE_RADIUS); p2.setRadiusY(CIRCLE_RADIUS); halfCircle.getElements().add(p1); halfCircle.getElements().add(p2); return halfCircle; }
private Path initializeLargeCircle() { final Path largeCircle = new Path(); largeCircle.setStroke(Color.BLACK); MoveTo p1 = new MoveTo(); ArcTo p2 = new ArcTo(); p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS)); p1.yProperty().bind(yProperty()); p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS)); p2.yProperty().bind(yProperty()); p2.setRadiusX(LARGE_CIRCLE_RADIUS); p2.setRadiusY(LARGE_CIRCLE_RADIUS); largeCircle.getElements().add(p1); largeCircle.getElements().add(p2); return largeCircle; }
private Path initializeMediumCircle() { final Path mediumCircle = new Path(); mediumCircle.setStroke(Color.BLACK); MoveTo p1 = new MoveTo(); ArcTo p2 = new ArcTo(); p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS)); p1.yProperty().bind(yProperty()); p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS)); p2.yProperty().bind(yProperty()); p2.setRadiusX(MEDIUM_CIRCLE_RADIUS); p2.setRadiusY(MEDIUM_CIRCLE_RADIUS); mediumCircle.getElements().add(p1); mediumCircle.getElements().add(p2); return mediumCircle; }
private Path initializeSmallCircle() { final Path smallCircle = new Path(); smallCircle.setStroke(Color.BLACK); MoveTo p1 = new MoveTo(); ArcTo p2 = new ArcTo(); p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS)); p1.yProperty().bind(yProperty()); p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS)); p2.yProperty().bind(yProperty()); p2.setRadiusX(SMALL_CIRCLE_RADIUS); p2.setRadiusY(SMALL_CIRCLE_RADIUS); smallCircle.getElements().add(p1); smallCircle.getElements().add(p2); return smallCircle; }
public void refreshStyle() { Path linePath = mLinePath; Label legendLabel = mLegendLabel; if (linePath == null && legendLabel == null) { return; } String style = buildStyle(); if (linePath != null) { linePath.setStyle(style); } if (legendLabel != null) { Line line = new Line(0, 0, 36, 0); line.setStyle(style); legendLabel.setGraphic(line); } }
public StyledTextPane() { textField = new CTextFlow(); caret = new Path(); FX.style(caret, CARET); caret.setManaged(false); caret.setStroke(Color.BLACK); getChildren().add(textField); caretTimeline = new Timeline(); caretTimeline.setCycleCount(Animation.INDEFINITE); // TODO property updateBlinkRate(Duration.millis(500)); // FIX allow custom handlers new StyledTextPaneMouseController(this); }
public TestTextFlowWindow() { super("TestTextFlowWindow"); setTitle("TextFlow Test"); setSize(600, 200); info = new Text(); highlight = new Path(); highlight.setManaged(false); highlight.setStroke(null); highlight.setFill(Color.YELLOW); caret = new Path(); caret.setManaged(false); caret.setStroke(Color.BLACK); setTop(tf()); setBottom(new CTextFlow(info)); }
/** * Once we have drawn the path, we call this method to generate two paths * (outer and inner paths) and get a SVGPath with them that can be exported * @param drawPath The original path * @param svg * @return the content string of the SVGPath with two paths */ public boolean generateOutline(Path drawPath, SVGPath svg) { Pane pane = (Pane) drawPath.getParent(); final double width = pane.getWidth() * WIDTH_FACTOR; Path outterPath = new Path(drawPath.getElements()); outterPath.setStroke(drawPath.getStroke()); outterPath.setStrokeLineJoin(drawPath.getStrokeLineJoin()); outterPath.setStrokeLineCap(drawPath.getStrokeLineCap()); outterPath.setStrokeWidth(width); Path s1 = (Path) Shape.subtract(outterPath, new Rectangle(0, 0)); Path innerPath = new Path(drawPath.getElements()); innerPath.setStrokeWidth(0); innerPath.setStroke(drawPath.getStroke()); innerPath.setStrokeLineJoin(drawPath.getStrokeLineJoin()); innerPath.setStrokeLineCap(drawPath.getStrokeLineCap()); Path s2 = (Path) Shape.subtract(innerPath, new Rectangle(0, 0)); Path result = (Path) Shape.subtract(s1, s2); clearSmallPolygons(result); svg.setContent(pathsToSVGPath()); return validPaths.size() == 2; }
private void clearSmallPolygons(Path... paths){ validPaths = new ArrayList<>(); Point2D p0 = Point2D.ZERO; for (Path path : paths) { for (PathElement elem : path.getElements()) { if (elem instanceof MoveTo) { elements = new ArrayList<>(); elements.add(elem); listPoints = new ArrayList<>(); p0 = new Point2D(((MoveTo)elem).getX(), ((MoveTo)elem).getY()); listPoints.add(p0); } else if (elem instanceof CubicCurveTo) { elements.add(elem); Point2D ini = listPoints.size() > 0 ? listPoints.get(listPoints.size() - 1) : p0; listPoints.addAll(evalCubicCurve((CubicCurveTo) elem, ini, POINTS_CURVE)); } else if (elem instanceof ClosePath) { elements.add(elem); listPoints.add(p0); if (Math.abs(calculateArea()) > MINIMUM_AREA) { validPaths.add(new Path(elements)); } } } } }
private String pathsToSVGPath() { final StringBuilder sb = new StringBuilder(); for (Path path : validPaths) { for (PathElement element : path.getElements()) { if (element instanceof MoveTo) { sb.append("M ").append(((MoveTo) element).getX()).append(" ") .append(((MoveTo) element).getY()); } else if (element instanceof CubicCurveTo) { CubicCurveTo curve = (CubicCurveTo) element; sb.append(" C ") .append(curve.getControlX1()).append(" ").append(curve.getControlY1()).append(" ") .append(curve.getControlX2()).append(" ").append(curve.getControlY2()).append(" ") .append(curve.getX()).append(" ").append(curve.getY()); } else if (element instanceof ClosePath) { sb.append(" Z "); } } } return sb.toString(); }
private void animate(Circle particle, Path path) { Random randGen = new Random(); PathTransition pathTransition = new PathTransition(Duration.seconds(path.getElements().size() * (randGen.nextInt(30) + 30)), path, particle); pathTransition.setInterpolator(Interpolator.EASE_OUT); ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(3f), particle); scaleTransition.setToX(10f); scaleTransition.setToY(10f); scaleTransition.setInterpolator(Interpolator.EASE_OUT); FadeTransition fadeTransition = new FadeTransition(Duration.seconds(6f), particle); fadeTransition.setToValue(0.7); fadeTransition.setInterpolator(Interpolator.EASE_OUT); pathTransition.play(); scaleTransition.play(); fadeTransition.play(); }
public void applyTransition(Node node) { PathTransition pathTransition = new PathTransition(); timeline = pathTransition; path = (Path) drawPath(140.0, 140.0, 0); path.setStrokeWidth(2); path.setStroke(Color.RED); path.setFill(Color.TRANSPARENT); pathTransition.setDuration(Duration.millis(motionDuration)); pathTransition.setNode(node); //pathTransition.setPath(AnimationPath.createFromPath(path)); pathTransition.setPath(path); pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT); }
@Override public Node drawNode() { currentTestNode = this; PathTransition pathTransition = new PathTransition(); Pane p = pre(pathTransition); Path path = createPath(); path.setStrokeWidth(2); path.setStroke(Color.RED); p.getChildren().add(path); path.setFill(Color.TRANSPARENT); pathTransition.setDuration(Duration.millis(typicalDuration)); pathTransition.setNode(circle); //pathTransition.setPath(AnimationPath.createFromPath(path)); pathTransition.setPath(path); pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT); timeline.setCycleCount(3); timeline.setAutoReverse(true); return p; }
void updateNodeColors() { // Set the colors, if we can if (series.getNode() != null && (colorStroke != null || colorFill != null)) { try { Group group = (Group)series.getNode(); Path seriesLine = (Path)group.getChildren().get(1); Path fillPath = (Path)group.getChildren().get(0); seriesLine.setStroke(colorStroke); fillPath.setFill(colorFill); // for (Data<Number, Number> item : series.getData()) { // if (item.getNode() != null) { // item.getNode().setStyle("fx-fill: red"); // } // } // if (group.getChildren().size() > 2) { // System.err.println(group.getChildren()); // } } catch (Exception e) { logger.error("Failed to set colors for series {}", series); } } }
private void initGraphics() { moveTo = new MoveTo(); upperLeft = new LineTo(); upperRight = new LineTo(); lowerRight = new LineTo(); lowerLeft = new LineTo(); path = new Path(); path.getElements().add(moveTo); path.getElements().add(upperLeft); path.getElements().add(upperRight); path.getElements().add(lowerRight); path.getElements().add(lowerLeft); path.getElements().add(new ClosePath()); path.getStyleClass().add("segment"); pane = new Pane(path); pane.getStyleClass().add("segment"); getChildren().setAll(pane); }
public void renderPath(Path2D p2d, Path p, WritableImage wimg) { if (useJava2D) { BufferedImage bimg = new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = bimg.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setColor(java.awt.Color.WHITE); g2d.fillRect(0, 0, TESTW, TESTH); g2d.setColor(java.awt.Color.BLACK); if (useJava2DClip) { g2d.setClip(p2d); g2d.fillRect(0, 0, TESTW, TESTH); g2d.setClip(null); } else { g2d.fill(p2d); } copy(bimg, wimg); } else { setPath(p, p2d); SnapshotParameters sp = new SnapshotParameters(); sp.setViewport(new Rectangle2D(0, 0, TESTW, TESTH)); p.snapshot(sp, wimg); } }
public void update(Path2D p2d) { setPath(resultpath, p2d); Path p = makePath(); WritableImage wimg = new WritableImage(TESTW, TESTH); renderPath(p2d, p, wimg); PixelReader pr = wimg.getPixelReader(); GraphicsContext gc = resultcv.getGraphicsContext2D(); gc.save(); for (int y = 0; y < TESTH; y++) { for (int x = 0; x < TESTW; x++) { boolean inpath = p2d.contains(x + 0.5, y + 0.5); boolean nearpath = near(p2d, x + 0.5, y + 0.5, warn); int pixel = pr.getArgb(x, y); renderPixelStatus(gc, x, y, pixel, inpath, nearpath); } } gc.restore(); }
@Override public void start(Stage stage) throws Exception { Path shape = new Path(new MoveTo(450, 450), new LineTo(-SIZE, -SIZE), new LineTo(0, -2 * SIZE), new LineTo(SIZE, -SIZE), new LineTo(450, 450), new ClosePath()); shape.setFill(Color.BLUE); shape.setStroke(Color.RED); shape.setStrokeWidth(2.0); shape.getStrokeDashArray().addAll(10.0, 5.0); Pane root = new Pane(); root.getChildren().add(shape); stage.setScene(new Scene(root, 900, 900)); stage.show(); }
/** * Generate the path transition. * * @param shape Shape to travel along path. * @param path Path to be traveled upon. * @param duration Duration of single animation. * @param delay Delay before beginning first animation. * @param orientation Orientation of shape during animation. * @return PathTransition. */ private PathTransition generatePathTransition( final Shape shape, final Path path, final Duration duration, final Duration delay, final OrientationType orientation) { final PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(duration); pathTransition.setDelay(delay); pathTransition.setPath(path); pathTransition.setNode(shape); pathTransition.setOrientation(orientation); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); return pathTransition; }
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) { final Path PATH = new Path(); PATH.setFillRule(FillRule.EVEN_ODD); while (!PATH_LIST.isEmpty()) { if ("M".equals(READER.read())) { PATH.getElements().add(new MoveTo(READER.nextX(), READER.nextY())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new LineTo(READER.nextX(), READER.nextY())); } else if ("C".equals(READER.read())) { PATH.getElements().add(new CubicCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("Q".equals(READER.read())) { PATH.getElements().add(new QuadCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("H".equals(READER.read())) { PATH.getElements().add(new HLineTo(READER.nextX())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new VLineTo(READER.nextY())); } else if ("A".equals(READER.read())) { PATH.getElements().add(new ArcTo(READER.nextX(), READER.nextY(), 0, READER.nextX(), READER.nextY(), false, false)); } else if ("Z".equals(READER.read())) { PATH.getElements().add(new ClosePath()); } } return PATH; }
/** * Animates card movements. * * @param card The card view to animate. * @param sourceX Source X coordinate of the card view. * @param sourceY Source Y coordinate of the card view. * @param targetX Destination X coordinate of the card view. * @param targetY Destination Y coordinate of the card view. * @param duration The duration of the animation. * @param doAfter The action to perform after the animation has been completed. */ private void animateCardMovement( CardView card, double sourceX, double sourceY, double targetX, double targetY, Duration duration, EventHandler<ActionEvent> doAfter) { Path path = new Path(); path.getElements().add(new MoveToAbs(card, sourceX, sourceY)); path.getElements().add(new LineToAbs(card, targetX, targetY)); PathTransition pathTransition = new PathTransition(duration, path, card); pathTransition.setInterpolator(Interpolator.EASE_IN); pathTransition.setOnFinished(doAfter); Timeline blurReset = new Timeline(); KeyValue bx = new KeyValue(card.getDropShadow().offsetXProperty(), 0, Interpolator.EASE_IN); KeyValue by = new KeyValue(card.getDropShadow().offsetYProperty(), 0, Interpolator.EASE_IN); KeyValue br = new KeyValue(card.getDropShadow().radiusProperty(), 2, Interpolator.EASE_IN); KeyFrame bKeyFrame = new KeyFrame(duration, bx, by, br); blurReset.getKeyFrames().add(bKeyFrame); ParallelTransition pt = new ParallelTransition(card, pathTransition, blurReset); pt.play(); }
public Text3DHelper(String text, String font, int size){ this.text=text; list=new ArrayList<>(); Text textNode = new Text(text); textNode.setFont(new Font(font,size)); // Convert Text to Path Path subtract = (Path)(Shape.subtract(textNode, new Rectangle(0, 0))); // Convert Path elements into lists of points defining the perimeter (exterior or interior) subtract.getElements().forEach(this::getPoints); // Group exterior polygons with their interior polygons polis.stream().filter(LineSegment::isHole).forEach(hole->{ polis.stream().filter(poly->!poly.isHole()) .filter(poly->!((Path)Shape.intersect(poly.getPath(), hole.getPath())).getElements().isEmpty()) .filter(poly->poly.getPath().contains(new Point2D(hole.getOrigen().x,hole.getOrigen().y))) .forEach(poly->poly.addHole(hole)); }); polis.removeIf(LineSegment::isHole); }
@Override public void Draw(Pane canvas) { double width = canvas.getWidth() * (GetDoubleAttribute("Width") / (double) MaximumX); double height = GetDoubleAttribute("Height") == 0 ? width : canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY); double left = canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX) - width / 2; double top = canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY) - height / 2; Path path = new Path(new PathElement[] { new MoveTo(0, height / 2), new LineTo(width / 2, 0), new LineTo(width, height / 2), new LineTo(width / 2, height), new LineTo(0, height / 2) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); path.setLayoutX(left); path.setLayoutY(top); canvas.getChildren().add(path); }
@Override public void Draw(Pane canvas) { double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; Path path = new Path(new PathElement[] { new MoveTo(widthX, 0), new LineTo(0, 0), new LineTo(0, widthY), new LineTo(canvas.getWidth() - widthX, canvas.getHeight()), new LineTo(canvas.getWidth(), canvas.getHeight()), new LineTo(canvas.getWidth(), canvas.getHeight() - widthY), new LineTo(widthX, 0) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); canvas.getChildren().add(path); }
@Override public void Draw(Pane canvas) { double outerDiamX = canvas.getWidth() * (GetDoubleAttribute("Width") / MaximumX); double outerDiamY = GetDoubleAttribute("Height") == 0 ? outerDiamX : canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY); double proportion = GetDoubleAttribute("Size") / MaximumX; double innerDiamX = outerDiamX * proportion; double innerDiamY = outerDiamY * proportion; double locX = (canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX)); double locY = (canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY)); Ellipse outer = new Ellipse(locX, locY, outerDiamX / 2, outerDiamY / 2); Ellipse inner = new Ellipse(locX, locY, innerDiamX / 2, innerDiamY / 2); Shape ring = Path.subtract(outer, inner); ring.setFill(GetColorAttribute("Color")); canvas.getChildren().add(ring); }
@Override protected Shape[] Thumbnail() { return new Shape[] { new Path(new PathElement[] { new MoveTo(0, 5), new LineTo(30, 5), new LineTo(30, 25), new LineTo(0, 25), new LineTo(0, 5), new MoveTo(5, 10), new LineTo(5, 20), new LineTo(25, 20), new LineTo(25, 10), new LineTo(5, 10) }) }; }
@Override public void Draw(Pane canvas) { double widthX = canvas.getWidth() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; double widthY = canvas.getHeight() * (GetDoubleAttribute("Thickness") / MaximumX) / 2; Path path = new Path(new PathElement[] { new MoveTo(canvas.getWidth() - widthX, 0), new LineTo(canvas.getWidth(), 0), new LineTo(canvas.getWidth(), widthY), new LineTo(widthX, canvas.getHeight()), new LineTo(0, canvas.getHeight()), new LineTo(0, canvas.getHeight() - widthY), new LineTo(canvas.getWidth() - widthX, 0) }); path.setFill(GetColorAttribute("Color")); path.setStrokeWidth(0); canvas.getChildren().add(path); }
@Override public void Draw(Pane canvas) { double height = canvas.getHeight(); double width = canvas.getWidth(); canvas.getChildren().add(new Rectangle(width, height, Colors[0])); Path p = new Path(new PathElement[] { new MoveTo(width, 0), new LineTo(width, height), new LineTo(0, height), new LineTo(width, 0) }); p.fillProperty().set(Colors[1]); p.strokeWidthProperty().set(0); canvas.getChildren().add(p); }
@Override public void Draw(Pane canvas) { double height = canvas.getHeight(); double width = canvas.getWidth(); canvas.getChildren().add(new Rectangle(width, height, Colors[0])); Path p = new Path(new PathElement[] { new MoveTo(0, height), new LineTo(width, 0), new LineTo(width, height), new LineTo(0, 0) }); p.fillProperty().set(Colors[1]); p.strokeWidthProperty().set(0); canvas.getChildren().add(p); }
@Override public void Draw(Pane canvas) { double height = canvas.getHeight(); double width = canvas.getWidth(); canvas.getChildren().add(new Rectangle(width, height, Colors[0])); Path p = new Path(new PathElement[] { new MoveTo(width, height), new LineTo(0, height), new LineTo(0, 0), new LineTo(width, height) }); p.fillProperty().set(Colors[1]); p.strokeWidthProperty().set(0); canvas.getChildren().add(p); }
/** * Constructs and binds the appropriate properties for the line and * the arrow */ public DirectedPath(DoubleBinding startX, DoubleBinding startY, DoubleBinding endX,DoubleBinding endY){ this.path = new Path(); MoveTo start = new MoveTo(); start.xProperty().bind(startX); start.yProperty().bind(startY); LineTo end = new LineTo(); end.xProperty().bind(endX); end.yProperty().bind(endY); path.getElements().add(start); path.getElements().add(end); this.arrow = getArrow(); this.getChildren().add(path); this.getChildren().add(arrow); this.path.getStyleClass().setAll("edge"); }