Java 类javafx.scene.shape.Circle 实例源码

项目:incubator-netbeans    文件:TimelineInterpolator.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 250, 90));

    //create circles by method createMovingCircle listed below
    Circle circle1 = createMovingCircle(Interpolator.LINEAR); //default interpolator
    circle1.setOpacity(0.7);
    Circle circle2 = createMovingCircle(Interpolator.EASE_BOTH); //circle slows down when reached both ends of trajectory
    circle2.setOpacity(0.45);
    Circle circle3 = createMovingCircle(Interpolator.EASE_IN);
    Circle circle4 = createMovingCircle(Interpolator.EASE_OUT);
    Circle circle5 = createMovingCircle(Interpolator.SPLINE(0.5, 0.1, 0.1, 0.5)); //one can define own behaviour of interpolator by spline method

    root.getChildren().addAll(
            circle1,
            circle2,
            circle3,
            circle4,
            circle5
    );
}
项目:H-Uppaal    文件:FilePresentation.java   
private void initializeIcon() {
    final Circle circle = (Circle) lookup("#iconBackground");
    final FontIcon icon = (FontIcon) lookup("#icon");

    component.get().colorProperty().addListener((obs, oldColor, newColor) -> {
        circle.setFill(newColor.getColor(component.get().getColorIntensity()));
        icon.setFill(newColor.getTextColor(component.get().getColorIntensity()));
    });

    circle.setFill(component.get().getColor().getColor(component.get().getColorIntensity()));
    icon.setFill(component.get().getColor().getTextColor(component.get().getColorIntensity()));

    component.get().isMainProperty().addListener((obs, oldIsMain, newIsMain) -> {
        if (newIsMain) {
            icon.setIconLiteral("gmi-star");
            icon.setIconSize(22);
        } else {
            icon.setIconLiteral("gmi-description");
            icon.setIconSize(22);
        }
    });
}
项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:InterpolatorSample.java   
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:marathonv5    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:marathonv5    文件:CircleSample.java   
public CircleSample() {
    super(180,90);
    // Simple red filled circle
    Circle circle1 = new Circle(45,45,40, Color.RED);
    // Blue stroked circle
    Circle circle2 = new Circle(135,45,40);
    circle2.setStroke(Color.DODGERBLUE);
    circle2.setFill(null);
    // Create a group to show all the circles);
    getChildren().add(new Group(circle1,circle2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
            new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:RadialGradientSample.java   
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);

    // show the circles
    getChildren().addAll(hb);
}
项目:LCL    文件:Transition.java   
public static void lollipop(double x, double y) {
    Circle circle = new Circle(x, y, 2);
    circle.setFill(randomColor());
    FrameController.instance.hover.getChildren().add(circle);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), circle);
    fadeTransition.setAutoReverse(true);
    fadeTransition.setCycleCount(2);
    fadeTransition.setFromValue(0.0);
    fadeTransition.setToValue(1.0);
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(1000), circle);
    scaleTransition.setToX(10.0);
    scaleTransition.setToY(10.0);
    scaleTransition.setCycleCount(1);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    executorService.schedule(() -> Platform.runLater(() ->
            FrameController.instance.hover.getChildren().remove(circle)), 1000, TimeUnit.MILLISECONDS);
}
项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:InterpolatorSample.java   
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:marathonv5    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:marathonv5    文件:CircleSample.java   
public CircleSample() {
    super(180,90);
    // Simple red filled circle
    Circle circle1 = new Circle(45,45,40, Color.RED);
    // Blue stroked circle
    Circle circle2 = new Circle(135,45,40);
    circle2.setStroke(Color.DODGERBLUE);
    circle2.setFill(null);
    // Create a group to show all the circles);
    getChildren().add(new Group(circle1,circle2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
            new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:RadialGradientSample.java   
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);

    // show the circles
    getChildren().addAll(hb);
}
项目:GazePlay    文件:Bubble.java   
private List<Circle> buildFragments(BubbleType bubbleType) {
    List<Circle> fragments = new ArrayList<>(nbFragments);

    for (int i = 0; i < nbFragments; i++) {

        Circle fragment = new Circle();
        fragment.setOpacity(1);
        fragment.setRadius(20);
        fragment.setVisible(true);
        fragment.setCenterX(-100);
        fragment.setCenterY(-100);

        if (bubbleType == BubbleType.COLOR) {
            fragment.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
        } else {
            fragment.setFill(new ImagePattern(newPhoto(), 0, 0, 1, 1, true));
        }

        fragments.add(fragment);
    }

    return fragments;
}
项目:charts    文件:World.java   
public void addLocation(final Location LOCATION) {
    double x = (LOCATION.getLongitude() + 180) * (PREFERRED_WIDTH / 360) + MAP_OFFSET_X;
    double y = (PREFERRED_HEIGHT / 2) - (PREFERRED_WIDTH * (Math.log(Math.tan((Math.PI / 4) + (Math.toRadians(LOCATION.getLatitude()) / 2)))) / (2 * Math.PI)) + MAP_OFFSET_Y;

    Circle locationIcon = new Circle(x, y, size * 0.01);
    locationIcon.setFill(null == LOCATION.getColor() ? getLocationColor() : LOCATION.getColor());

    StringBuilder tooltipBuilder = new StringBuilder();
    if (!LOCATION.getName().isEmpty()) tooltipBuilder.append(LOCATION.getName());
    if (!LOCATION.getInfo().isEmpty()) tooltipBuilder.append("\n").append(LOCATION.getInfo());
    String tooltipText = tooltipBuilder.toString();
    if (!tooltipText.isEmpty()) {
        Tooltip tooltip = new Tooltip(tooltipText);
        tooltip.setFont(Font.font(10));
        Tooltip.install(locationIcon, tooltip);
    }

    if (null != LOCATION.getMouseEnterHandler()) locationIcon.setOnMouseEntered(new WeakEventHandler<>(LOCATION.getMouseEnterHandler()));
    if (null != LOCATION.getMousePressHandler()) locationIcon.setOnMousePressed(new WeakEventHandler<>(LOCATION.getMousePressHandler()));
    if (null != LOCATION.getMouseReleaseHandler()) locationIcon.setOnMouseReleased(new WeakEventHandler<>(LOCATION.getMouseReleaseHandler()));
    if (null != LOCATION.getMouseExitHandler()) locationIcon.setOnMouseExited(new WeakEventHandler<>(LOCATION.getMouseExitHandler()));


    locations.put(LOCATION, locationIcon);
}
项目:board-client    文件:Othello.java   
public Node createPiece(int piece, int column, int row) {
    switch (piece) {
    case 0:
        Circle black = new Circle(30, 30, 25);
        black.setFill(Color.BLACK);
        return black;
    case 1:
        Circle white = new Circle(30, 30, 25);
        white.setFill(Color.WHITE);
        return white;
    default:
        Circle transparent = new Circle(30, 30, 25);
        transparent.setFill(Color.TRANSPARENT);
        return transparent;
    }
}
项目:GazePlay    文件:Bubble.java   
public Bubble(Scene scene) {

        this.scene = scene;

        enterEvent = new EventHandler<Event>() {
            @Override
            public void handle(Event e) {

               // System.out.println(e.getEventType() + " " + e.getTarget());
                if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                    //System.out.println(e.getEventType());
                    enter((Circle) e.getTarget());
                }
            }
        };

        for (int i = 0; i < 20; i++) {

            newCircle();
        }
    }
项目:GazePlay    文件:Bubble.java   
private void moveCircle(Circle C) {

        double centerX = (scene.getWidth() - maxRadius) * Math.random() + maxRadius;
        double centerY = scene.getHeight();

        C.setCenterX(centerX);
        //C.setTranslateY((scene.getHeight() - maxRadius) * Math.random() + maxRadius);
        C.setCenterY(centerY);
        double radius = (maxRadius - minRadius) * Math.random() + minRadius;
        C.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
        C.setRadius(radius);

        Timeline timeline = new Timeline();

        double timelength = ((maxTimeLength - minTimeLength) * Math.random() + minTimeLength) * 1000;

        timeline.getKeyFrames().add(new KeyFrame(new Duration(timelength), new KeyValue(C.centerYProperty(), 0 - maxRadius, Interpolator.EASE_IN)));

       /* SequentialTransition sequence = new SequentialTransition();

        for(int i = 0; i < 10; i++) {
            sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX - 100)));
            sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX + 100)));
        }*/

        timeline.play();

        timeline.setOnFinished(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {

                //moveCircle(C);
                newCircle();
            }
        });
    }
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final Link subject, final ArrowHead target) {
    final Circle arrowHeadField = new Circle();
    arrowHeadField.centerXProperty().bind(target.xProperty());
    arrowHeadField.centerYProperty().bind(target.yProperty());
    arrowHeadField.setRadius(target.getHeadHeight());

    final LineBinding lineBinding = LineBinding.getCircleBindings(arrowHeadField, new Point(subject.startXProperty(), subject.startYProperty()));

    if (target.shouldBindToTip()) {
        subject.endXProperty().bind(target.xProperty());
        subject.endYProperty().bind(target.yProperty());
    } else {
        subject.endXProperty().bind(lineBinding.startX);
        subject.endYProperty().bind(lineBinding.startY);
    }
}
项目:GraphCreator    文件:LineGraph.java   
private void initialize(double width, double height){
    this.setScaleY(-1);
    this.interval = 1;
    this.currentX = 0;
    this.setMaxWidth(width);
    this.setMaxHeight(height);
    this.setWidth(width);
    this.setHeight(height);
    this.setMinWidth(width);
    this.setMinHeight(height);
    this.points = new ArrayList<>();
    this.isRendered = false;
    this.isNormalized = false;
    this.isManualEntry = false;

    //Unique identification
    this.setId(UUID.randomUUID().toString());

    //Layers
    this.graphPath = new SVGPath();
    this.pointLines = new SVGPath();
    this.pointDots = new Pane();

    //Styling values
    this.smoothing = 0.2;
    this.circleStyle = new Circle();
    this.close = true;
    graphPath.setStrokeWidth(1);
    graphPath.setStroke(BLACK);
    graphPath.setFill(TRANSPARENT);
    graphPath.setStrokeLineJoin(StrokeLineJoin.ROUND);
    pointLines.setStrokeWidth(0.5);
    pointLines.setStroke(BLACK);
    circleStyle.setRadius(2);
    circleStyle.setFill(BLACK);
}
项目:GraphCreator    文件:LineGraph.java   
private void renderPoints(){
    for(int i = 0; i<points.size(); i++){
        Circle c = new Circle(points.get(i).getX(), points.get(i).getY(),circleStyle.getRadius(), circleStyle.getFill());
        c.setStroke(circleStyle.getStroke());
        c.setStrokeWidth(circleStyle.getStrokeWidth());
        c.setStrokeType(circleStyle.getStrokeType());
        c.setStrokeLineJoin(circleStyle.getStrokeLineJoin());
        c.setStrokeLineCap(circleStyle.getStrokeLineCap());
        c.setStyle(circleStyle.getStyle());
        pointDots.getChildren().add(c);
    }
}
项目:incubator-netbeans    文件:TimelineEvents.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 260,100));
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    root.getChildren().add(stack);
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureHand() {
    Circle circle = new Circle(0, 0, radius / 18);
    circle.setFill(color);
    Rectangle rectangle1 = new Rectangle(-0.5 - radius / 140, +radius / 7 - radius / 1.08, radius / 70 + 1, radius / 1.08);
    Rectangle rectangle2 = new Rectangle(-0.5 - radius / 140, +radius / 3.5 - radius / 7, radius / 70 + 1, radius / 7);
    rectangle1.setFill(color);
    rectangle2.setFill(Color.BLACK);
    hand.getChildren().addAll(circle, rectangle1, rectangle2);
}
项目:incubator-netbeans    文件:PuzzlePieces.java   
private Shape createPieceTab(double eclipseCenterX, double eclipseCenterY, double eclipseRadiusX, double eclipseRadiusY,
                             double rectangleX, double rectangleY, double rectangleWidth, double rectangleHeight,
                             double circle1CenterX, double circle1CenterY, double circle1Radius,
                             double circle2CenterX, double circle2CenterY, double circle2Radius) {
    Ellipse e = new Ellipse(eclipseCenterX, eclipseCenterY, eclipseRadiusX, eclipseRadiusY);
    Rectangle r = new Rectangle(rectangleX, rectangleY, rectangleWidth, rectangleHeight);
    Shape tab = Shape.union(e, r);
    Circle c1 = new Circle(circle1CenterX, circle1CenterY, circle1Radius);
    tab = Shape.subtract(tab, c1);
    Circle c2 = new Circle(circle2CenterX, circle2CenterY, circle2Radius);
    tab = Shape.subtract(tab, c2);
    return tab;
}
项目:incubator-netbeans    文件:DigitalClock.java   
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
    play();
}
项目:lttng-scope    文件:ExampleMouseDrag.java   
@Override
public void start(Stage primaryStage) {
    if (primaryStage == null) {
        return;
    }

    //Create Circles
    Circle circleRed = new Circle(50.0, Color.RED);
    circleRed.setCursor(Cursor.HAND);
    circleRed.setOnMousePressed(circleOnMousePressedEventHandler);
    circleRed.setOnMouseDragged(circleOnMouseDraggedEventHandler);

    Circle circleGreen = new Circle(50.0, Color.GREEN);
    circleGreen.setCursor(Cursor.MOVE);
    circleGreen.setCenterX(150);
    circleGreen.setCenterY(150);
    circleGreen.setOnMousePressed(circleOnMousePressedEventHandler);
    circleGreen.setOnMouseDragged(circleOnMouseDraggedEventHandler);

    Circle circleBlue = new Circle(50.0, Color.BLUE);
    circleBlue.setCursor(Cursor.CROSSHAIR);
    circleBlue.setTranslateX(300);
    circleBlue.setTranslateY(100);
    circleBlue.setOnMousePressed(circleOnMousePressedEventHandler);
    circleBlue.setOnMouseDragged(circleOnMouseDraggedEventHandler);

    Group root = new Group();
    root.getChildren().addAll(circleRed, circleGreen, circleBlue);

    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 400,350));

    primaryStage.setTitle("java-buddy");
    primaryStage.show();
}
项目:lttng-scope    文件:ExampleMouseDrag.java   
@Override
public void handle(MouseEvent t) {
    double offsetX = t.getSceneX() - orgSceneX;
    double offsetY = t.getSceneY() - orgSceneY;
    double newTranslateX = orgTranslateX + offsetX;
    double newTranslateY = orgTranslateY + offsetY;

    ((Circle)(t.getSource())).setTranslateX(newTranslateX);
    ((Circle)(t.getSource())).setTranslateY(newTranslateY);
}
项目:marathonv5    文件:TimelineEventsSample.java   
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
项目:marathonv5    文件:CircleSample.java   
public static Node createIconContent() {
    Circle circle = new Circle(57,57,40);
    circle.setStroke(Color.web("#b9c0c5"));
    circle.setStrokeWidth(5);
    circle.getStrokeDashArray().addAll(15d,15d);
    circle.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));
    circle.setEffect(effect);
    return circle;
}
项目:marathonv5    文件:DigitalClock.java   
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
项目:marathonv5    文件:TimelineEventsSample.java   
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
项目:marathonv5    文件:CircleSample.java   
public static Node createIconContent() {
    Circle circle = new Circle(57,57,40);
    circle.setStroke(Color.web("#b9c0c5"));
    circle.setStrokeWidth(5);
    circle.getStrokeDashArray().addAll(15d,15d);
    circle.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));
    circle.setEffect(effect);
    return circle;
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureHand() {
    Circle circle = new Circle(0, 0, radius / 18);
    circle.setFill(color);
    Rectangle rectangle1 = new Rectangle(-0.5 - radius / 140, +radius / 7 - radius / 1.08, radius / 70 + 1, radius / 1.08);
    Rectangle rectangle2 = new Rectangle(-0.5 - radius / 140, +radius / 3.5 - radius / 7, radius / 70 + 1, radius / 7);
    rectangle1.setFill(color);
    rectangle2.setFill(Color.BLACK);
    hand.getChildren().addAll(circle, rectangle1, rectangle2);
}
项目:Dronology    文件:InteractiveWayPointDot.java   
public InteractiveWayPointDot(int x, int y) throws FlightZoneException{
    wayPointDot = new Circle();
    wayPointDot.setRadius(radius);;
    wayPointDot.setCenterX(x);
    wayPointDot.setCenterY(y);
    wayPointDot.setFill(Color.LIGHTSTEELBLUE);
    wayPointDot.setStroke(Color.BLACK);
    wayPointDot.setStrokeWidth(1);
    longitude = DecimalDegreesToXYConverter.getInstance().ConvertXCoordsToDecimalDegrees(x);
    latitude = DecimalDegreesToXYConverter.getInstance().ConvertYCoordsToDecimalDegrees(y);
    this.x = x;
    this.y = y;
}
项目:octoBubbles    文件:SequenceDiagramController.java   
public void initMessageHandleActions(MessageEdgeView edgeView){
    Circle circleHandle = edgeView.getCircleHandle();
    circleHandle.setOnMousePressed(event -> {
        if(tool == ToolEnum.SELECT){
            mode = Mode.DRAGGING;
            selectedEdges.add(edgeView);
            previousMoveX = event.getX();
            previousMoveY = event.getY();
            initMoveX = event.getX();
            initMoveY = event.getY();
        }
    });

    circleHandle.setOnMouseDragged(event -> {
        double offsetX =  (event.getX() - previousMoveX)*(1/drawPane.getScaleX());
        double offsetY = (event.getY() - previousMoveY)*(1/drawPane.getScaleY());
        previousMoveX = event.getX();
        previousMoveY = event.getY();
        if(mode == Mode.DRAGGING){
            MessageEdge edge = (MessageEdge)edgeView.getRefEdge();
            edge.setStartX(edge.getStartX() + offsetX);
            edge.setStartY(edge.getStartY() + offsetY);
        }
    });

    circleHandle.setOnMouseReleased(event -> {
        undoManager.add(new MoveMessageCommand((MessageEdge)edgeView.getRefEdge(), edgeView.getStartX() - initMoveX, edgeView.getStartY() - initMoveY));
        mode = Mode.NO_MODE;
        previousMoveX = 0;
        previousMoveY = 0;
    });
}
项目:Dronology    文件:DroneBase.java   
/** 
 * Constructor
 * @param baseName Unique basename
 * @param latitude of base
 * @param longitude of base
 * @param altitude of base
 * @throws FlightZoneException 
 */
public DroneBase(String baseName, long lat, long lon, int alt, int radius) throws FlightZoneException{
    basePosition = new Coordinates(lat,lon,alt);
    coordTransform = DecimalDegreesToXYConverter.getInstance();
    this.baseName = baseName;   
    circle = new Circle();
    circle.setRadius(radius);
    Point point = coordTransform.getPoint(lat, lon);
    circle.setCenterX(point.getX()+radius*.6);
    circle.setCenterY(point.getY()+radius*.6);
    circle.setFill(Color.LIGHTYELLOW);
    circle.setStroke(Color.BLACK);
    circle.setStrokeWidth(1);
}
项目:HotaruFX    文件:CircleNode.java   
private CircleNode(Circle circle) {
    super(circle);
    this.circle = circle;
    centerX = PropertyTimelineHolder.empty();
    centerY = PropertyTimelineHolder.empty();
    radius = PropertyTimelineHolder.empty();
}