当前位置: 首页>>代码示例>>Java>>正文


Java Circle类代码示例

本文整理汇总了Java中javafx.scene.shape.Circle的典型用法代码示例。如果您正苦于以下问题:Java Circle类的具体用法?Java Circle怎么用?Java Circle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Circle类属于javafx.scene.shape包,在下文中一共展示了Circle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javafx.scene.shape.Circle; //导入依赖的package包/类
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
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:TimelineInterpolator.java

示例2: initializeIcon

import javafx.scene.shape.Circle; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:23,代码来源:FilePresentation.java

示例3: createMovingCircle

import javafx.scene.shape.Circle; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:InterpolatorSample.java

示例4: TimelineSample

import javafx.scene.shape.Circle; //导入依赖的package包/类
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
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:TimelineSample.java

示例5: CircleSample

import javafx.scene.shape.Circle; //导入依赖的package包/类
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
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:CircleSample.java

示例6: RadialGradientSample

import javafx.scene.shape.Circle; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:25,代码来源:RadialGradientSample.java

示例7: lollipop

import javafx.scene.shape.Circle; //导入依赖的package包/类
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);
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:19,代码来源:Transition.java

示例8: TranslateTransitionSample

import javafx.scene.shape.Circle; //导入依赖的package包/类
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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:TranslateTransitionSample.java

示例9: buildFragments

import javafx.scene.shape.Circle; //导入依赖的package包/类
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;
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:24,代码来源:Bubble.java

示例10: addLocation

import javafx.scene.shape.Circle; //导入依赖的package包/类
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);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:26,代码来源:World.java

示例11: createPiece

import javafx.scene.shape.Circle; //导入依赖的package包/类
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;
	}
}
 
开发者ID:edwardxia,项目名称:board-client,代码行数:17,代码来源:Othello.java

示例12: start

import javafx.scene.shape.Circle; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Test");

    primaryStage.setFullScreen(true);

    Group root = new Group();

    Scene scene = new Scene(root, 1200, 700, Color.BLACK);

    Circle circle = new Circle(200, 300, 100, Color.YELLOW);

    root.getChildren().add(circle);

    GazeUtils.addEventFilter(circle);

    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:20,代码来源:Test.java

示例13: Bubble

import javafx.scene.shape.Circle; //导入依赖的package包/类
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();
        }
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:23,代码来源:Bubble.java

示例14: moveCircle

import javafx.scene.shape.Circle; //导入依赖的package包/类
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();
            }
        });
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:38,代码来源:Bubble.java

示例15: bind

import javafx.scene.shape.Circle; //导入依赖的package包/类
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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:17,代码来源:BindingHelper.java


注:本文中的javafx.scene.shape.Circle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。