import com.sun.javafx.geom.RectBounds; import javafx.application.*; import javafx.animation.*; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.geometry.Bounds; import javafx.util.*; import javafx.stage.*; import javafx.scene.*; import javafx.scene.paint.*; import javafx.scene.shape.*; public class ScaledCircleBug extends Application { public void start(Stage stage) { final Circle c = new Circle(250, 250, 50); c.setStrokeWidth(25); c.setStroke(Color.BLUE); c.setFill(Color.GREEN); c.setScaleX(2.0); final Rectangle r = new Rectangle(); r.setStroke(Color.RED); r.setFill(null); c.boundsInParentProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable o) { final Bounds bounds = c.getBoundsInParent(); r.setX(bounds.getMinX()); r.setY(bounds.getMinY()); r.setWidth(bounds.getWidth()); r.setHeight(bounds.getHeight()); } }); KeyValue kv1 = new KeyValue(c.rotateProperty(), 360.0); KeyFrame kf = new KeyFrame(new Duration(1000), kv1); Timeline t = new Timeline(kf); t.setCycleCount(Timeline.INDEFINITE); t.play(); Scene scene = new Scene(new Group(c, r), 500, 500); stage.setScene(scene); stage.setVisible(true); } public static void main(String argv[]) { launch(ScaledCircleBug.class, argv); } }