Some weird things happened with JavaFX-application, working good on non-touchscreen Ubuntu 13.04. OnMouseClickedListener and any others, like onAction or onTouch don't catch Events , but CSS-styled buttons changes to selected while we touch it.. so the application knows, that button was touched. Also weird things happens with onAction listener: touch events are catches by applications, which placed "under" my app.
Code of adding touch listener:
btn1.setOnTouchPressed(new EventHandler<TouchEvent>() {
@Override
public void handle(TouchEvent touchEvent) {
// deal with touch
touchEvent.consume();
}
});
Code of adding touch listener and on action listener:
<Button fx:id="btn2" onMouseClicked="#clicksHandler" text="btn"/>
<Button fx:id="btn3" onAction="#actionHandler" text="btn"/>
And handlers of this events:
@FXML
private void actionHandler(Event event){
// Handle event
event.consume();
}
@FXML
private void clicksHandler(MouseEvent event){
// Handle event
event.consume();
}
Please, help to solve this problem.
Was founded workaround: installing ubuntu 12.04 LTS. Events are handled by OnMouseClickedListener.