title: When click on Hyperlink in JavaFX, a relevant URL should open in browser
body: <p>I am developing an application in which I have some links added to the <code>Listview</code>, and these links will keep on adding at runtime on some condition. What I can't find is a way to to open a url when clicking on a particular link.</p>
  <p>This is the code for adding links into list view</p>
  <pre><code>if (counter == 1) {
      Task task2 = new Task&lt;Void&gt;() {
          @Override
          public Void call() throws Exception {
  
              Platform.runLater(new Runnable() {
                  public void run() {
                      link = new Hyperlink(val);
                      link.setStyle(&quot;-fx-border-style: none;&quot;);
                      items.add(link);
                      listview.setItems(items);
                  }
              });
              return null;
          }
      };
      Thread th = new Thread(task2);
      th.setDaemon(true);
      th.start();
      Thread.sleep(1000);
  }
  </code></pre>
  <p>I know I need to use something like this to open a url in browser when click on link:</p>
  <pre><code> getHostServices().showDocument(link.getText()); 
  </code></pre>
  <p>I don't know how to listen/track the click event for different links.</p>