‘Font Awesome’ Icons with JavaFX: minor updates
Refer for latest updates here.
Hi,
some minor FontAwesomeFX updates:
The AwesomeDude
now provides convenience methods to add an AwesomeFont-Icon to existing Labeled
-controls and MenuItems
by setting the graphic node:
labeled.setGraphic(createIconLabel(icon,iconSize));
Recall that direct subclasses of Labeled
are ButtonBase
, Cell
, Label
, TitledPane
and their friends (by now I have not tested all combination).
setIcon(Labeled labeled, AwesomeIcon icon) setIcon(Labeled labeled, AwesomeIcon icon, ContentDisplay contentDisplay) setIcon(Labeled labeled, AwesomeIcon icon, String iconSize) setIcon(Labeled labeled, AwesomeIcon icon, String iconSize, ContentDisplay contentDisplay) setIcon(MenuItem menuItem, AwesomeIcon icon) setIcon(MenuItem menuItem, AwesomeIcon icon, String iconSize) setIcon(MenuItem menuItem, AwesomeIcon icon, String fontSize, String iconSize)
Usage
For example, I use the new methods for the UI of my RaspberryPi Home project:
AwesomeDude.setIcon(onButton, AwesomeIcon.LIGHTBULB, "72px"); AwesomeDude.setIcon(offButton, AwesomeIcon.LIGHTBULB, "72px"); AwesomeDude.setIcon(exitButton, AwesomeIcon.POWER_OFF, "48px");
Looks like this:
Source
@ Bitbucket
Maven
<dependency> <groupId>de.jensd</groupId> <artifactId>fontawesomefx</artifactId> <version>8.0.1</version> </dependency>