Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Nebula FontAwesome"
(Created page with "< Back to Nebula Main Page =Screenshot= File:Fontawesomesnippet.png An utility class that allows developers to use the '''Font Awesome''' with some SWT Widg...") |
m |
||
Line 26: | Line 26: | ||
# You set this font to the widget | # You set this font to the widget | ||
# You select the desired icon and get the corresponding String constant in the class FontAwesome. | # You select the desired icon and get the corresponding String constant in the class FontAwesome. | ||
− | # You call the method setText() of the widget | + | # You call the method setText() of the widget. Use a FontAwesome constant on as parameter (like FontAwesome.code for instance) |
Line 40: | Line 40: | ||
These examples are also available here : | These examples are also available here : | ||
− | [https://github.com/eclipse/nebula/blob/master/widgets/fontawesome/org.eclipse.nebula.widgets.fontawesome.snippets/src/org/eclipse/nebula/widgets/fontawesome/FontAwesomeSnippet.java FontAwesomeSnippet.java] | + | * [https://github.com/eclipse/nebula/blob/master/widgets/fontawesome/org.eclipse.nebula.widgets.fontawesome.snippets/src/org/eclipse/nebula/widgets/fontawesome/FontAwesomeSnippet.java FontAwesomeSnippet.java] |
− | [https://github.com/eclipse/nebula/blob/master/widgets/fontawesome/org.eclipse.nebula.widgets.fontawesome.snippets/src/org/eclipse/nebula/widgets/fontawesome/FontAwesomeSnippet2.java FontAwesomeSnippet2.java] | + | * [https://github.com/eclipse/nebula/blob/master/widgets/fontawesome/org.eclipse.nebula.widgets.fontawesome.snippets/src/org/eclipse/nebula/widgets/fontawesome/FontAwesomeSnippet2.java FontAwesomeSnippet2.java] |
Latest revision as of 06:22, 19 March 2020
Screenshot
An utility class that allows developers to use the Font Awesome with some SWT Widgets.
Contents
Introduction
The utility class is called FontAwesome
. It contains 2 methods :
-
getFont()
returns the FontAwesome font with a size of 14px -
getFont(int size)
returns the FontAwesome font for the given size
It contains also a list of constants, each one associated to an icon.
Usage
All widgets that have a setFont()
and a setText()
methods can use FontAwesome.
- You have to call the method
FontAwesome.getFont()
to get the relevant font. - You set this font to the widget
- You select the desired icon and get the corresponding String constant in the class FontAwesome.
- You call the method setText() of the widget. Use a FontAwesome constant on as parameter (like FontAwesome.code for instance)
Here is an example with a Label
:
Label text = new Label(shell, SWT.NONE); text.setFont(FontAwesome.getFont(22)); text.setText(FontAwesome.code);
Examples
2 examples called FontAwesomeSnippet.java and FontAwesomeSnippet2.java are located in the plugin org.eclipse.nebula.widgets.fontawesome.snippets.
These examples are also available here :