package de.fhg.iwes.javafx.test; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.stage.StageStyle; import javafx.util.Duration; public class JavaFxStageTransparentPerformanceProblem extends Application { public static void main(String[] args) { Application.launch(JavaFxStageTransparentPerformanceProblem.class, args); } @Override public void start(final Stage primaryStage) throws Exception { // Set up stage primaryStage.setTitle("JavaFX 2.0.1"); final Group root = new Group(); final Scene scene = new Scene(root, 800, 600); primaryStage.setScene(scene); primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.show(); Rectangle rectangle = new Rectangle(400, 300, Color.BLUE); rectangle.setLayoutX(200); rectangle.setLayoutY(150); root.getChildren().add(rectangle); KeyValue keyValue = new KeyValue(rectangle.rotateProperty(), 360, Interpolator.LINEAR); KeyFrame keyFrame = new KeyFrame(Duration.seconds(3), keyValue); Timeline timeline = new Timeline(30, keyFrame); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); Button btnExit = new Button("Exit"); btnExit.setOnAction(new EventHandler() { public void handle(ActionEvent arg0) { primaryStage.close(); } }); root.getChildren().add(btnExit); } }