Official FontAwesome support in JVx

Post to Twitter

We're happy to announce that JVx got "official" (experimental) support for FontAwesome icons. We made some changes to our internal image management but it wasn't a big change and no API was touched!

How it works?

Simple, as usual :)

An example:

UIButton button = new Button("Press me");
button.setImage(UIImage.getImage(IFontAwesome.USER_SMALL);

But that's not all because we support special things like coloring, e.g.:

UIButton button = new Button("Press me");
button.setImage(UIImage.getImage(IFontAwesome.USER_SMALL + ";color=orange");

and it's also possible to set the size:

UIButton button = new Button("Press me");
button.setImage(UIImage.getImage(IFontAwesome.USER_SMALL + ";size=24;color=orange");

The support was split in different parts. JVx got the IFontAwesome interface which defines FontAwesome icon names. This doesn't mean that every UI implementation supports FontAwesome!

Every UI has to support FontAwesome because it's UI dependent how font icons will be rendered.

We have support in our Swing UI and vaadin UI, but currently we don't have support in our JavaFX UI (not yet). This means, that you can use FontAwesome directly in your JVx application out-of-the-box without manual configuration and without accessing resources directly.

Pure Swing

We have a read-to-use FontAwesome ImageIcon for Swing developers. It's called JVxFontAwesome. It's easy to use this icon in your Swing application, also without JVx UI.

vaadinUI

There are some limitations in Vaadin, because it's not possible to add custom style properties to menu items via API calls. It's possibel via css files, but this is a limitation you should know. Sure, it shouldn't be a big problem but vaadin doesn't support this feature right now.

Vaadin up to 7.5.6 has support for FontAwesome 4.1.0 and JVx has support for 4.4.0. Not all icons are available in vaadin UI right now! There's a ticket about an update to 4.4.0.

JavaFX UI, native mobile clients

We didn't implement FontAwesome in JavaFX UI or our Android, iOS clients - not yet. It shouldn't be a big problem to implement the support but we're still in an experimental phase ;)

Leave a Reply

Spam protection by WP Captcha-Free