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

[Glass, Graphics] Performance issue when tracking mouse events

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
      None

      Description

      I have a simple program that allows me to drag a circle around a scene. I'm not sure if I'm doing something wrong but the circle always seems to lag the position of the mouse. It just feels wrong.

      This is using Java 8 build b117 and happens on both Windows 7 64bit and Linux 64bit.

      To reproduce run the code below and drag the circle about quite quickly.

      Here is the code:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.FlowPane;
      import javafx.scene.shape.Circle;
      import javafx.stage.Stage;

      public class DragTest extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              FlowPane flowPane = new FlowPane();
              Scene scene = new Scene(flowPane, 500, 500);
              stage.setScene(scene);
              double circleRadius = 20;
              Circle circle = new Circle(circleRadius);
              circle.setOnMouseDragged(mouseEvent -> {
                  circle.setTranslateX(mouseEvent.getSceneX() - circleRadius);
                  circle.setTranslateY(mouseEvent.getSceneY() - circleRadius);
              });
              flowPane.getChildren().add(circle);
              stage.show();
          }

          public static void main(String[] args) {
              Application.launch(args);
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ndarcy Nick D'Arcy
              • Votes:
                6 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported: