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

Single click on button shows up as double click

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • Mac and Windows.

      Product: javafx-2.0beta
      Platform: macosx-universal
      Build-Number: 212
      Build-ID: 2011-07-20_11-17-41

      A single click on a button produces a mouse event where getClickCount() returns 2. A double click returns 4, and so on.

      Test program:

      public class DeleteMe extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              final Label label = new Label();
              Button button = ButtonBuilder.create()
                      .text("Click me")
                      .onMouseClicked(new EventHandler<MouseEvent>() {
                          @Override public void handle(MouseEvent event) {
                              label.setText("Click " + event.getClickCount());
                          }
                      })
                      .build();
              Scene scene = new Scene(VBoxBuilder.create().spacing(10).children(label, button).build());
              StageBuilder.create().scene(scene).visible(true).applyTo(stage);
          }
      }

      The context is that we have a set of ToggleButtons that can be used to select a template. You can select either by clicking on one of the buttons and then on a Select button, or by double-clicking on the button. But in fact the double click shows up as a single click.

            psafrata Pavel Ĺ afrata
            emcmanuswse Eamonn McManus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: