title: addEventHandler to TreeItem in javafx
body: <p>I'm new in Java and I need a help. I want to add event to specific TreeItem in my TreeView. I have some code and it doesn't work. What am I doing wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>TreeItem&lt;String&gt; item = new TreeItem&lt;&gt;(s);
  
  item.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler&lt;MouseEvent&gt;(){
                  public void handle(MouseEvent e) {
                      System.out.println("Hello World");
                  }
              });
  
  this.item.getChildren().add(item);
  </code></pre>
  
  <p>It creates a TreeView, but the event doesn't work.</p>
  
  <p>Thanks for your help.</p>