Action. It can also directly be used in FXML.
Examples:
new Button("", new Glyph("FontAwesome", "BEER"))
new Button("", new Glyph("FontAwesome", FontAwesome.Glyph.BEER))
Thy Glyph-Class also offers a fluent API to customize the look of the Glyph.
For example, you can set the color color(javafx.scene.paint.Color) or
also add effects such as useHoverEffect()
An ability to retrieve glyph node by combination of font name and glyph name
extends to the org. graphic attribute, where the "font>"
prefix should be used. For more information see org..
| Modifier and Type | Field and Description |
|---|---|
| public static final String | DEFAULT_CSS_CLASS
* Private fields * * |
| private final ObjectProperty | |
| public static final String | |
| public static final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Glyph | |
| public static Glyph | |
| public Glyph | |
| public Glyph | Returns: Returns this instance for fluent APIA font family name fontFamily)Sets the glyph icon font family |
| public String | |
| public double | |
| public Object | |
| public String | getUserAgentStylesheet()
Overrides javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. |
| public ObjectProperty | |
| public void | |
| public void | setFontFamily(String family)
Sets the font family of this glyph Font size is reset to default glyph font size |
| public void | |
| public void | |
| private void | |
| public Glyph | |
| public Glyph | Returns: Returns this instance for fluent APISets glyph size using size factor based on default font size |
| private void | updateIcon()
This updates the text with the correct unicode value so that the desired icon is displayed. |
| public Glyph | |
| public Glyph |
| DEFAULT_CSS_CLASS | back to summary |
|---|---|
| public static final String DEFAULT_CSS_CLASS * Private fields * * | |
| icon | back to summary |
|---|---|
| private final ObjectProperty<Object> icon | |
| STYLE_GRADIENT | back to summary |
|---|---|
| public static final String STYLE_GRADIENT | |
| STYLE_HOVER_EFFECT | back to summary |
|---|---|
| public static final String STYLE_HOVER_EFFECT | |
| Glyph | back to summary |
|---|---|
| public Glyph() Empty Constructor (used by FXML) | |
| Glyph | back to summary |
|---|---|
| public Glyph(String fontFamily, char unicode) Creates a new Glyph
| |
| Glyph | back to summary |
|---|---|
| public Glyph(String fontFamily, Object icon) Creates a new Glyph | |
| color | back to summary |
|---|---|
| public Glyph color(Color color) Sets the glyph color
| |
| create | back to summary |
|---|---|
| public static Glyph create(String fontAndGlyph) Retrieve glyph by font name and glyph name using one string where font name an glyph name are separated by pipe. | |
| duplicate | back to summary |
|---|---|
| public Glyph duplicate() Implements org. Allows glyph duplication. Since in the JavaFX scenegraph it is not possible to insert the same
| |
| fontFamily | back to summary |
|---|---|
| public Glyph fontFamily(String fontFamily) Sets the glyph icon font family | |
| getFontFamily | back to summary |
|---|---|
| public String getFontFamily() Gets the font family of this glyph | |
| getFontSize | back to summary |
|---|---|
| public double getFontSize() Gets the font size of this glyph | |
| getIcon | back to summary |
|---|---|
| public Object getIcon() | |
| getUserAgentStylesheet | back to summary |
|---|---|
| public String getUserAgentStylesheet() Overrides javafx. Doc from javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls. The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath. Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.
For additional information about using CSS with the scene graph,
see the CSS Reference Guide.
| |
| iconProperty | back to summary |
|---|---|
| public ObjectProperty The icon name property. This must either be a Glyph-Name (either string or enum value) known by the GlyphFontRegistry. Alternatively, you can directly submit a unicode character here. | |
| setColor | back to summary |
|---|---|
| public void setColor(Color color) Set the Color of this Glyph | |
| setFontFamily | back to summary |
|---|---|
| public void setFontFamily(String family) Sets the font family of this glyph Font size is reset to default glyph font size | |
| setFontSize | back to summary |
|---|---|
| public void setFontSize(double size) Sets the font size of this glyph | |
| setIcon | back to summary |
|---|---|
| public void setIcon(Object iconValue) Set the icon to display.
| |
| setTextUnicode | back to summary |
|---|---|
| private void setTextUnicode(char unicode) Sets the given char as text | |
| size | back to summary |
|---|---|
| public Glyph size(double size) Sets glyph size
| |
| sizeFactor | back to summary |
|---|---|
| public Glyph sizeFactor(int factor) Sets glyph size using size factor based on default font size
| |
| updateIcon | back to summary |
|---|---|
| private void updateIcon() This updates the text with the correct unicode value so that the desired icon is displayed. | |
| useGradientEffect | back to summary |
|---|---|
| public Glyph useGradientEffect() Adds the gradient effect style
| |
| useHoverEffect | back to summary |
|---|---|
| public Glyph useHoverEffect() Adds the hover effect style
| |