List of usage examples for javafx.scene.shape Circle setStrokeWidth
public final void setStrokeWidth(double value)
From source file:Main.java
@Override public void start(Stage stage) { Circle circle = new Circle(40); circle.setFill(Color.RED);/* www . j av a 2s . c om*/ circle.setStroke(Color.BLACK); circle.setStrokeWidth(2.0); Rectangle rect = new Rectangle(120, 75); rect.setFill(Color.RED); // Create a line Line line = new Line(0, 0, 150, 50); line.setStrokeWidth(5.0); line.setStroke(Color.GREEN); // Create a parallelogram Polygon parallelogram = new Polygon(); parallelogram.getPoints().addAll(30.0, 0.0, 130.0, 0.0, 120.00, 50.0, 0.0, 50.0); parallelogram.setFill(Color.AZURE); parallelogram.setStroke(Color.BLACK); // Create a hexagon Polyline hexagon = new Polyline(100.0, 0.0, 120.0, 20.0, 110.0, 140.0, 100.0, 60.0, 80.0, 40.0, 80.0, 120.0, 100.0, 0.0); hexagon.setFill(Color.WHITE); hexagon.setStroke(Color.BLACK); // A CHORD arc with no fill and a stroke Arc arc = new Arc(0, 0, 50, 100, 0, 90); arc.setFill(Color.TRANSPARENT); arc.setStroke(Color.BLACK); arc.setType(ArcType.CHORD); // Add all shapes to an HBox HBox root = new HBox(circle, rect, line, parallelogram, hexagon, arc); root.setSpacing(10); root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;"); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("2D Shapes"); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 800, 600, Color.BLACK); primaryStage.setScene(scene);// w w w . jav a2 s. c om Group circles = new Group(); for (int i = 0; i < 30; i++) { Circle circle = new Circle(150, Color.web("white", 0.05)); circle.setStrokeType(StrokeType.OUTSIDE); circle.setStroke(Color.web("white", 0.16)); circle.setStrokeWidth(4); circles.getChildren().add(circle); } Rectangle colors = new Rectangle(scene.getWidth(), scene.getHeight(), new LinearGradient(0f, 1f, 1f, 0f, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#f8bd55")), new Stop(0.14, Color.web("#c0fe56")), new Stop(0.28, Color.web("#5dfbc1")), new Stop(0.43, Color.web("#64c2f8")), new Stop(0.57, Color.web("#be4af7")), new Stop(0.71, Color.web("#ed5fc2")), new Stop(0.85, Color.web("#ef504c")), new Stop(1, Color.web("#f2660f")), })); Group blendModeGroup = new Group( new Group(new Rectangle(scene.getWidth(), scene.getHeight(), Color.BLACK), circles), colors); colors.setBlendMode(BlendMode.OVERLAY); root.getChildren().add(blendModeGroup); circles.setEffect(new BoxBlur(10, 10, 3)); Timeline timeline = new Timeline(); for (Node circle : circles.getChildren()) { timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO, // set start position at 0 new KeyValue(circle.translateXProperty(), random() * 800), new KeyValue(circle.translateYProperty(), random() * 600)), new KeyFrame(new Duration(40000), // set end position at 40s new KeyValue(circle.translateXProperty(), random() * 800), new KeyValue(circle.translateYProperty(), random() * 600))); } // play 40s of animation timeline.play(); primaryStage.show(); }
From source file:org.noroomattheinn.visibletesla.LocationController.java
private Animation animateBlip() { final Circle core = new Circle(572, 360, 5); final Circle blip = new Circle(572, 360, 5); final Circle outline = new Circle(572, 360, 5); Duration blipTime = Duration.seconds(1.5); Duration interBlipTime = Duration.seconds(0.5); core.setFill(Color.BLUE);/* w ww. j a v a 2s . c o m*/ blip.setFill(Color.LIGHTBLUE); outline.setFill(Color.TRANSPARENT); outline.setStroke(Color.DARKBLUE); outline.setStrokeWidth(0.25); root.getChildren().addAll(blip, core, outline); FadeTransition fadeBlip = new FadeTransition(blipTime, blip); fadeBlip.setFromValue(0.8); fadeBlip.setToValue(0.0); ScaleTransition scaleBlip = new ScaleTransition(blipTime, blip); scaleBlip.setFromX(1); scaleBlip.setToX(4); scaleBlip.setFromY(1); scaleBlip.setToY(4); FadeTransition fadeOutline = new FadeTransition(blipTime, outline); fadeOutline.setFromValue(1.0); fadeOutline.setToValue(0.0); ScaleTransition scaleOutline = new ScaleTransition(blipTime, outline); scaleOutline.setFromX(1); scaleOutline.setToX(4); scaleOutline.setFromY(1); scaleOutline.setToY(4); SequentialTransition sequence = new SequentialTransition( new ParallelTransition(fadeBlip, scaleBlip, scaleOutline, fadeOutline), new PauseTransition(interBlipTime)); sequence.setCycleCount(Timeline.INDEFINITE); sequence.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { core.setVisible(false); blip.setVisible(false); outline.setVisible(false); } }); sequence.play(); return sequence; }