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

Ending Drag and Drop on the button that started it clicks the button

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      Kubuntu 20.04
      JDK 15+36
      JavaFX 15 (als Maven Dependency)

      A DESCRIPTION OF THE PROBLEM :
      When starting a Drag and Drop gesture on a button and ending it on that same button, no matter whether it left the button in the meantime or not,
      the Drag and Drop action will be performed as expected.
      However, what is unexpected is that the button will additionally perform its clicked action, even though to humans that .

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a button inside a scene with a recognizable action that gets performed when it gets clicked.
      2. Start a Drag and Drop gesture from that button.
      (3. Move randomly.)
      4. End Drag and Drop gesture on that button.
      5. Enjoy: The action will get performed, even though every human would say that this dragging was definitely not a click.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Buttons don't get clicked when ending the drag and drop gesture there.
      ACTUAL -
      Buttons get clicked.

      ---------- BEGIN SOURCE ----------
      // Will work if FX components are present and a JVM >= 1.8 is used

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class TestCase extends Application {

      @Override
      public void start(Stage stage) throws Exception {
      BorderPane layout = new BorderPane();
      final Button button = new Button("Test Button");
      button.setOnAction(e -> System.out.println("The button got clicked"));
      layout.setCenter(button);
      stage.setScene(new Scene(layout));
      stage.show();
      }

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

      ---------- END SOURCE ----------

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: