Example usage for javafx.scene.shape Circle setRadius

List of usage examples for javafx.scene.shape Circle setRadius

Introduction

In this page you can find the example usage for javafx.scene.shape Circle setRadius.

Prototype

public final void setRadius(double value) 

Source Link

Usage

From source file:Main.java

static Node dropShadow() {
    Group g = new Group();
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);/*from w  w  w . j a  v a 2 s . c o  m*/
    ds.setColor(Color.color(0.4f, 0.4f, 0.4f));

    Text t = new Text();
    t.setEffect(ds);
    t.setCache(true);
    t.setX(10.0f);
    t.setY(270.0f);
    t.setFill(Color.RED);
    t.setText("JavaFX drop shadow...");
    t.setFont(Font.font("null", FontWeight.BOLD, 32));

    DropShadow ds1 = new DropShadow();
    ds1.setOffsetY(4.0f);

    Circle c = new Circle();
    c.setEffect(ds1);
    c.setCenterX(50.0f);
    c.setCenterY(325.0f);
    c.setRadius(30.0f);
    c.setFill(Color.ORANGE);
    c.setCache(true);

    g.getChildren().add(t);
    g.getChildren().add(c);
    return g;
}

From source file:Main.java

static Node blendMode() {
    Rectangle r = new Rectangle();
    r.setX(590);/*from  www  . j av  a  2s. c o m*/
    r.setY(50);
    r.setWidth(50);
    r.setHeight(50);
    r.setFill(Color.BLUE);

    Circle c = new Circle();
    c.setFill(Color.rgb(255, 0, 0, 0.5f));
    c.setCenterX(590);
    c.setCenterY(50);
    c.setRadius(25);

    Group g = new Group();
    g.setBlendMode(BlendMode.MULTIPLY);
    g.getChildren().add(r);
    g.getChildren().add(c);
    return g;
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF"));

    Circle circle = new Circle();
    circle.setCenterX(100.0f);/*www. j a  v a2 s .  co m*/
    circle.setCenterY(100.0f);
    circle.setRadius(50.0f);

    root.getChildren().add(circle);

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds1 = new DropShadow();
    ds1.setOffsetY(4.0);/* ww  w.j ava2 s  .  c o  m*/

    Circle c = new Circle();
    c.setEffect(ds1);
    c.setCenterX(50.0);
    c.setCenterY(125.0);
    c.setRadius(30.0);
    c.setFill(Color.RED);
    c.setCache(true);

    g.getChildren().add(c);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Pages.LandingPage.java

public void profilePicture(String picture, Stage theStage) {
    // <editor-fold defaultstate="collapsed" desc="Circle Image">

    profile_pic = (new ImageView(new Image(picture)));
    Rectangle square = new Rectangle();
    square.setWidth(150);//from   w ww . ja  va2 s.  c  o  m
    square.setHeight(150);
    profile_pic.setClip(square);
    Circle clip = new Circle();
    clip.setCenterX(75);
    clip.setCenterY(75);
    clip.setRadius(75);
    profile_pic.fitWidthProperty().bind(square.widthProperty());
    profile_pic.fitHeightProperty().bind(square.heightProperty());
    profile_pic.setClip(clip);

    profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            createProfilePicture(theStage);
        }

    });

    userbox.getChildren().add(profile_pic);
    // </editor-fold>  
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param iNumZone numro de la zone//from ww  w  .  ja va 2  s.co m
 * @param cercle cercle concern
 * @return ancres cercles
 */
private static ObservableList<AncreForme> olCreeAncresPourCercle(int iNumZone, Circle cercle) {
    ObservableList<AncreForme> olAnchors = FXCollections.observableArrayList();

    DoubleProperty xProperty1 = new SimpleDoubleProperty(cercle.getCenterX());
    DoubleProperty yProperty1 = new SimpleDoubleProperty(cercle.getCenterY());
    olAnchors.add(new AncreForme(Color.GOLD, xProperty1, yProperty1));
    DoubleProperty xProperty2 = new SimpleDoubleProperty(cercle.getCenterX() + cercle.getRadius());
    DoubleProperty yProperty2 = new SimpleDoubleProperty(cercle.getCenterY());
    final AncreForme ancRayon = new AncreForme(Color.BLUEVIOLET, xProperty2, yProperty2);
    olAnchors.add(ancRayon);
    xProperty1.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        double dX = (double) x - cercle.getCenterX();
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setCenterX((double) x);
        ancRayon.setCenterX(ancRayon.getCenterX() + dX);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);

    });

    yProperty1.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        double dY = -cercle.getCenterY() + (double) y;
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setCenterY((double) y);
        ancRayon.setCenterY(ancRayon.getCenterY() + dY);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });
    xProperty2.addListener((ObservableValue<? extends Number> ov, Number oldX, Number x) -> {
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - (double) x, 2.d)
                + Math.pow(cercle.getCenterY() - yProperty2.get(), 2.d));
        cercle.setRadius(rayon);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    yProperty2.addListener((ObservableValue<? extends Number> ov, Number oldY, Number y) -> {
        double rayon = Math.sqrt(Math.pow(cercle.getCenterX() - xProperty2.get(), 2.d)
                + Math.pow(cercle.getCenterY() - (double) y, 2.d));
        cercle.setRadius(rayon);
        String chaine = Math.round(cercle.getCenterX() * 10) / 10 + ","
                + Math.round(cercle.getCenterY() * 10) / 10 + "," + Math.round(rayon * 10) / 10;
        zones[iNumZone].setStrCoordonneesZone(chaine);
    });

    return olAnchors;
}