TextArea does not handle MouseEvent.MOUSE_PRESSED

I am building a JavaFX application and I have a TextArea inserted. The TextArea has a CSS class assigned (don't know if it matters):


There are 2 issues about this TextArea:

  1. -fx-cursor:default; Has no effect as the cursor remains the text cursor. That is weird as i use the same class for a TextField with proper/expected results
  2. The TextArea does not handle MOUSE_PRESSED eventMy code is :

    textArea.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { System.out.println("print message"); } });

Any ideas Why? I want to note that when I changed EventHanler to handle MOUSE_CLICKED everything is fine


I suspect the default handlers for mouse events on the TextArea are consuming the mouse pressed event before it gets to your handler.

Install an EventFilter instead:

textArea.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
            public void handle(MouseEvent event) {
                System.out.println("mouse pressed");

The Event filter will get processed before the default handlers see the event.

For your css issue, try

.default-cursor .content {
  -fx-cursor: default ;

Need Your Help

Rails backend for an iOS app, twitter sign in

ios ruby-on-rails authentication twitter omniauth

I'm using omniauth-twitter for twitter log in to the website and it works perfectly well (go to /auth/twitter, user authenticates, and then redirect_to /auth/twitter/callback). Great.

Laravel 4 routing problems

php laravel laravel-4

I'm having issues with my routes in my Laravel 4.1 website.