The AvatarView can display either an image or the user's initials if no image is provided. The appearance of the avatar can be customized with properties such as clip type (circular or rectangular), round size for rectangular avatars, and the size of the avatar.
The following CSS properties can be used to style the AvatarView:
The default style class for this control is "avatar-view".
| Modifier and Type | Class and Description |
|---|---|
| public static enum | AvatarView.
Enumeration representing the shape of the avatar. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final DoubleProperty | |
| private final StyleableObjectProperty | |
| private static final double | |
| private static final AvatarView. | |
| private static final double | |
| private static final String | |
| private final ObjectProperty | |
| private final StringProperty | |
| private final IntegerProperty | |
| private final IntegerProperty | |
| private final DoubleProperty |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AvatarView(String
the initials initials, Image the image image)Constructs a new avatar view with the given initials and image. |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final DoubleProperty | |
| public final ObjectProperty | |
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| public final double | |
| public final AvatarView. | |
| public static List | getClassCssMetaData()
Hides javafx. Gets the |
| protected List | getControlCssMetaData()
Overrides javafx. Gets the unmodifiable list of the control's CSS-styleable properties. |
| public final Image | |
| public final String | |
| public final int | |
| public final double | |
| 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 final ObjectProperty | Returns: the image propertyThe image of the user that should be displayed in the avatar. |
| public final StringProperty | Returns: the initials propertyThe initials of the user that should be displayed in the avatar. |
| public final IntegerProperty | Returns: the number of supported stylesA property used to specify how many different styles the application wants to support for styling the view based on the initials. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final DoubleProperty | |
| private void |
| arcSize | back to summary |
|---|---|
| private final DoubleProperty arcSize | |
| avatarShape | back to summary |
|---|---|
| private final StyleableObjectProperty<AvatarView. | |
| DEFAULT_ARC_SIZE | back to summary |
|---|---|
| private static final double DEFAULT_ARC_SIZE | |
| DEFAULT_AVATAR_SHAPE | back to summary |
|---|---|
| private static final AvatarView. | |
| DEFAULT_SIZE | back to summary |
|---|---|
| private static final double DEFAULT_SIZE | |
| DEFAULT_STYLE_CLASS | back to summary |
|---|---|
| private static final String DEFAULT_STYLE_CLASS | |
| image | back to summary |
|---|---|
| private final ObjectProperty<Image> image | |
| initials | back to summary |
|---|---|
| private final StringProperty initials | |
| magicNumber | back to summary |
|---|---|
| private final IntegerProperty magicNumber | |
| numberOfStyles | back to summary |
|---|---|
| private final IntegerProperty numberOfStyles | |
| size | back to summary |
|---|---|
| private final DoubleProperty size | |
| AvatarView | back to summary |
|---|---|
| public AvatarView() Constructs a new avatar view with no initials and no image. The view will fall back to showing the default icon. | |
| AvatarView | back to summary |
|---|---|
| public AvatarView(String initials, Image image) Constructs a new avatar view with the given initials and image. The view will display the image unless it is null. Should the image be removed at a later point in time then the initials will be shown. | |
| AvatarView | back to summary |
|---|---|
| public AvatarView(String initials) Constructs a new avatar view with the given initials. If an image gets added later on then the image will be shown.
| |
| AvatarView | back to summary |
|---|---|
| public AvatarView(Image image) Constructs a new avatar view with the given image.
| |
| arcSizeProperty | back to summary |
|---|---|
| public final DoubleProperty arcSizeProperty() The round size property of the avatar. This property represents the degree of rounding applied to the corners of a rectangular avatar. If the avatar is circular, this property is not used.
| |
| avatarShapeProperty | back to summary |
|---|---|
| public final ObjectProperty The clip type property of the avatar. This property determines the shape of the avatar, whether it is circular or rectangular.
| |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. Create a new instance of the default skin for this control. This is called to create a skin for the control if
no skin is provided via CSS
| |
| getArcSize | back to summary |
|---|---|
| public final double getArcSize() | |
| getAvatarShape | back to summary |
|---|---|
| public final AvatarView. | |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Doc from javafx. Gets the | |
| getControlCssMetaData | back to summary |
|---|---|
| protected List Overrides javafx. Doc from javafx. Gets the unmodifiable list of the control's CSS-styleable properties.
| |
| getImage | back to summary |
|---|---|
| public final Image getImage() | |
| getInitials | back to summary |
|---|---|
| public final String getInitials() | |
| getNumberOfStyles | back to summary |
|---|---|
| public final int getNumberOfStyles() | |
| getSize | back to summary |
|---|---|
| public final double getSize() | |
| 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.
| |
| imageProperty | back to summary |
|---|---|
| public final ObjectProperty The image of the user that should be displayed in the avatar.
| |
| initialsProperty | back to summary |
|---|---|
| public final StringProperty initialsProperty() The initials of the user that should be displayed in the avatar. The initials are used as a fallback if no image is provided. If an image is provided and has finished loading, the initials are not displayed.
| |
| numberOfStylesProperty | back to summary |
|---|---|
| public final IntegerProperty numberOfStylesProperty() A property used to specify how many different styles the application wants to support for styling the view based on the initials. By default, this value is "5", which means that the view will have styles like this: style0, style1, style2, style3, style4 (but always only one of them). These five styles will use five different background colors. Please be aware that changing the number of styles requires you to define additional CSS rules as the default agent stylesheet that ships with this control only supports five different styles out of the box.
| |
| setArcSize | back to summary |
|---|---|
| public final void setArcSize(double arcSize) | |
| setAvatarShape | back to summary |
|---|---|
| public final void setAvatarShape(final AvatarView. | |
| setImage | back to summary |
|---|---|
| public final void setImage(Image image) | |
| setInitials | back to summary |
|---|---|
| public final void setInitials(String initials) | |
| setNumberOfStyles | back to summary |
|---|---|
| public final void setNumberOfStyles(int numberOfStyles) | |
| setSize | back to summary |
|---|---|
| public final void setSize(double size) | |
| sizeProperty | back to summary |
|---|---|
| public final DoubleProperty sizeProperty() The size property of the avatar. This property represents the diameter (size) of the avatar.
| |
| updateMagicNumber | back to summary |
|---|---|
| private void updateMagicNumber() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final AvatarView. | ROUND
The avatar will have a circular shape. |
| public static final AvatarView. | SQUARE
The avatar will have a rectangular shape. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AvatarView. | |
| public static AvatarView. |
| ROUND | back to summary |
|---|---|
| public static final AvatarView. The avatar will have a circular shape. | |
| SQUARE | back to summary |
|---|---|
| public static final AvatarView. The avatar will have a rectangular shape. | |
| AvatarShape | back to summary |
|---|---|
| private AvatarShape() | |
| valueOf | back to summary |
|---|---|
| public static AvatarView. | |
| values | back to summary |
|---|---|
| public static AvatarView. | |
| Modifier and Type | Field and Description |
|---|---|
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final List |
| Access | Constructor and Description |
|---|---|
| private |
| AVATAR_ARC_SIZE | back to summary |
|---|---|
| private static final CssMetaData<AvatarView, Number> AVATAR_ARC_SIZE | |
| AVATAR_SHAPE | back to summary |
|---|---|
| private static final CssMetaData<AvatarView, AvatarView. | |
| AVATAR_SIZE | back to summary |
|---|---|
| private static final CssMetaData<AvatarView, Number> AVATAR_SIZE | |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |