Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088984

[Windows] Very poor performance of application (or Menus) when using an Animation




      I've noticed a huge performance hit in our application since JavaFX 8. Appearently it is related to Animation.

      Especially the Menu/Popup/ContextMenu become very lazy und unresponsive.

      Here's a little sample app to reproduce.

      1. Start the app.
      2. Resize the window often. This seems to trigger some sort of repaint (?). (Just drag a window corner around wildly)
      3. Then click the menu. It takes a few seconds until the menu popups up.
      4. Hover the menu items 1-10 with your mouse (back and forth).
      => Notice how lazy the selection changes.

      In our application it is even reproducible without resizing the window. I guess there's some other repaint logic, e.g. when a ListView (items) changes.

      I've also tested with 8u20 b110. It's also reproducible there.

      If there's a workaround, let me know, please.

      import javafx.animation.Animation;
      import javafx.animation.FadeTransition;
      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Circle;
      import javafx.scene.shape.Shape;
      import javafx.stage.Stage;
      import javafx.util.Duration;

      public class TestApp3 extends Application {
          public static void main(String[] args) {

          public void start(final Stage stage) {

              VBox vBox = new VBox();
              vBox.setPadding(new Insets(20, 20, 20, 20));

              MenuBar menuBar = new MenuBar();
              Menu menu = new Menu("Click Me");

              for (int i = 0; i < 10; i++) {
                  menu.getItems().add(new MenuItem("Item" + i));

              Shape shape = new Circle(30, Color.ORANGE);
              final FadeTransition fadeTransition = new FadeTransition(Duration.seconds(0.5), shape);


              Scene scene = new Scene(vBox);


        Issue Links



              Unassigned Unassigned
              cschudtjfx Christian Schudt (Inactive)
              1 Vote for this issue
              13 Start watching this issue