The impressive thing about Java FX is how well developers can use CSS to style the look and feel of the user interface.

The ComboBox component by default has an arrow icon pointing downward. The requirement given to me was to have two arrows, one pointing up and the other pointing down (see image). I figure the easiest would be to use an image to change it.


However, if the height of the ComboBox changes, so will the image. But since the image I had was small, it would not look good when it is expanded.

The solution I came up with was to change using an SVG or what is known is scaled vector graphics. This is more convenient and advantageous because even if it gets scaled to a smaller or bigger size, the quality of the graphics will still be the same.

In the CSS file, I did it like this. 

Now all ComboBox components in your scene, will have the up and down arrow icon.

You can now use Google search to find Scalable Vector Graphics (SVG) documents. SVG is an open, XML-based format for vector graphics with support for interactive elements. Google has made it its mission to organize the world’s information, so indexing SVG is a natural step.

SVG content whether a standalone file or embedded directly in HTML will be indexed. Do not get too overexcited though. The web is big, so it may take some time before they will be able to crawl and index most SVG files, but as of today you may start seeing them in your search results. If you want to see it yourself, try searching for [sitemap] or [HideShow]

If you host SVG files and you wish to exclude them from Google’s search results, you can use the “X-Robots-Tag: noindex” directive in the HTTP header.

Related Posts Plugin for WordPress, Blogger...