-
Bug
-
Resolution: Unresolved
-
P4
-
8, 8u5, 8u20
-
Windows 7
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) {
launch(args);
}
@Override
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");
menuBar.getMenus().addAll(menu);
vBox.getChildren().addAll(menuBar);
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);
fadeTransition.setAutoReverse(true);
fadeTransition.setCycleCount(Animation.INDEFINITE);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.playFromStart();
vBox.getChildren().add(shape);
Scene scene = new Scene(vBox);
stage.setScene(scene);
stage.show();
}
}
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) {
launch(args);
}
@Override
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");
menuBar.getMenus().addAll(menu);
vBox.getChildren().addAll(menuBar);
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);
fadeTransition.setAutoReverse(true);
fadeTransition.setCycleCount(Animation.INDEFINITE);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.playFromStart();
vBox.getChildren().add(shape);
Scene scene = new Scene(vBox);
stage.setScene(scene);
stage.show();
}
}
- relates to
-
JDK-8087922 [Glass, Graphics] Performance issue when tracking mouse events
- Open