In Swing, an image button is possible by setting the background color of the JButton to transparent and the image will still show its pressed and normal state effect when clicked.
In Java FX 2 however, when you add an image to the Button control and set the background to transparent using -fx-background-color: transparent, you are left with a static image that does not move whenever you click on it.
There is no ready made class in Java FX 2 that does this so the only solution left is to make one. What I did is extend from Button class and simulate the pressed and released effect by changing the padding values whenever a mouse event occurs.
There will be cases where we may want our text in strings.xml intact without adding HTML tags in order for hyperlinks to be shown as underlined and colored blue. Just like my experience.
I did not want the text in my strings.xml file for this certain variable to have HTML formatted tags within it.
Let us have an example:
XHTML
1
<string name="test">This is a hyperlink, so <a href="http://www.google.com">click me</a>.</string>
To make the hyperlink in the TextView to be linkable, simply call this programmatically: