-
Bug
-
Resolution: Fixed
-
P3
-
fx2.0
-
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.
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.
- duplicates
-
JDK-8113842 Inconsistent click count in mouse events
- Closed
- relates to
-
JDK-8114176 Modal stage cannot be closed
- Closed