Search code examples
javafxjavafx-8jfxtras

How disable handling mouse events on content area in jfxtras window?


I can drag jfxtras Window by clicking on ImageView in window area. I need to handle mouse move, swipe... events by ImageView. How disable handling mouse events on content window area?

Note: You can drag window by ImageView in content area, but can't by Button.


Solution

  • I found solution. But it seems like hack:

    imageView.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {                    
            window.setMovable(false)
        }
    });
    imageView.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            window.setMovable(true);
        }
    });