Friday, June 8, 2012

JavaFX 2: Hyperlinks

In this JavaFX tutorial I am going to create four hyperlinks and demnstrate how you can open that hyperlink in your JavaFX 2 application. The Hyperlink class represents another type of Labeled control, which is used mainly for formatting text as a hyperlink. In order to open a hyperlink in our JavaFX 2 application we will need to use WebView. If you don't know what is WebView, please see the tutorial by clicking here.

 Below you can take a look how our example will look in the end.

JavaFX 2 Hyperlink
JavaFX 2 Hyperlinks
You can take a look at source code of our example. It creates four hyperlinks with text captions and images. When a hyperlink is clicked, the corresponding value is passed as a URL to the embedded browser. Also as you can see, hyperlinks are created with for loop. 

Here is the picture used in this example: 

0 comments:

Post a Comment