- All Implemented Interfaces:
javafx.css.Styleable,javafx.event.EventTarget,javafx.scene.control.Skinnable
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:
- -fx-clip-type: Defines the clipping type of the avatar (circular or rectangular).
- -fx-round-size: Defines the corner roundness of rectangular avatars.
- -fx-avatar-size: Defines the size of the avatar.
The default style class for this control is "avatar-view".
-
Property Summary
PropertiesTypePropertyDescriptionfinal javafx.beans.property.DoublePropertyThe round size property of the avatar.final javafx.beans.property.ObjectProperty<AvatarView.AvatarShape>The clip type property of the avatar.final javafx.beans.property.ObjectProperty<javafx.scene.image.Image>The image of the user that should be displayed in the avatar.final javafx.beans.property.StringPropertyThe initials of the user that should be displayed in the avatar.final javafx.beans.property.IntegerPropertyA property used to specify how many different styles the application wants to support for styling the view based on the initials.final javafx.beans.property.DoublePropertyThe size property of the avatar.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration representing the shape of the avatar. -
Field Summary
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new avatar view with no initials and no image.AvatarView(String initials) Constructs a new avatar view with the given initials.AvatarView(String initials, javafx.scene.image.Image image) Constructs a new avatar view with the given initials and image.AvatarView(javafx.scene.image.Image image) -
Method Summary
Modifier and TypeMethodDescriptionfinal javafx.beans.property.DoublePropertyThe round size property of the avatar.final javafx.beans.property.ObjectProperty<AvatarView.AvatarShape>The clip type property of the avatar.protected javafx.scene.control.Skin<?>final doubleGets the value of the property arcSize.final AvatarView.AvatarShapeGets the value of the property avatarShape.static List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> protected List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> final javafx.scene.image.ImagegetImage()Gets the value of the property image.final StringGets the value of the property initials.final intGets the value of the property numberOfStyles.final doublegetSize()Gets the value of the property size.final javafx.beans.property.ObjectProperty<javafx.scene.image.Image>The image of the user that should be displayed in the avatar.final javafx.beans.property.StringPropertyThe initials of the user that should be displayed in the avatar.final javafx.beans.property.IntegerPropertyA property used to specify how many different styles the application wants to support for styling the view based on the initials.final voidsetArcSize(double arcSize) Sets the value of the property arcSize.final voidSets the value of the property avatarShape.final voidsetImage(javafx.scene.image.Image image) Sets the value of the property image.final voidsetInitials(String initials) Sets the value of the property initials.final voidsetNumberOfStyles(int numberOfStyles) Sets the value of the property numberOfStyles.final voidsetSize(double size) Sets the value of the property size.final javafx.beans.property.DoublePropertyThe size property of the avatar.Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
numberOfStyles
public final javafx.beans.property.IntegerProperty numberOfStylesPropertyA 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.- See Also:
-
initials
public final javafx.beans.property.StringProperty initialsPropertyThe 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.
- See Also:
-
image
public final javafx.beans.property.ObjectProperty<javafx.scene.image.Image> imagePropertyThe image of the user that should be displayed in the avatar.- See Also:
-
arcSize
public final javafx.beans.property.DoubleProperty arcSizePropertyThe 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.
- See Also:
-
size
public final javafx.beans.property.DoubleProperty sizePropertyThe size property of the avatar.This property represents the diameter (size) of the avatar.
- See Also:
-
avatarShape
The clip type property of the avatar.This property determines the shape of the avatar, whether it is circular or rectangular.
-
-
Constructor Details
-
AvatarView
public AvatarView()Constructs a new avatar view with no initials and no image. The view will fall back to showing the default icon. -
AvatarView
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.- Parameters:
initials- the initialsimage- the image
-
AvatarView
Constructs a new avatar view with the given initials. If an image gets added later on then the image will be shown.- Parameters:
initials- the initials
-
AvatarView
public AvatarView(javafx.scene.image.Image image)
-
-
Method Details
-
createDefaultSkin
protected javafx.scene.control.Skin<?> createDefaultSkin()- Overrides:
createDefaultSkinin classjavafx.scene.control.Control
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheetin classjavafx.scene.layout.Region
-
getNumberOfStyles
public final int getNumberOfStyles()Gets the value of the property numberOfStyles.- Property description:
- 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.
-
numberOfStylesProperty
public final javafx.beans.property.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.- See Also:
-
setNumberOfStyles
public final void setNumberOfStyles(int numberOfStyles) Sets the value of the property numberOfStyles.- Property description:
- 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.
-
getInitials
Gets the value of the property initials.- Property description:
- 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.
-
initialsProperty
public final javafx.beans.property.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.
- See Also:
-
setInitials
Sets the value of the property initials.- Property description:
- 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.
-
imageProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.image.Image> imageProperty()The image of the user that should be displayed in the avatar.- See Also:
-
getImage
public final javafx.scene.image.Image getImage()Gets the value of the property image.- Property description:
- The image of the user that should be displayed in the avatar.
-
setImage
public final void setImage(javafx.scene.image.Image image) Sets the value of the property image.- Property description:
- The image of the user that should be displayed in the avatar.
-
getArcSize
public final double getArcSize()Gets the value of the property arcSize.- Property description:
- 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.
-
arcSizeProperty
public final javafx.beans.property.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.
- See Also:
-
setArcSize
public final void setArcSize(double arcSize) Sets the value of the property arcSize.- Property description:
- 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.
-
getSize
public final double getSize()Gets the value of the property size.- Property description:
- The size property of the avatar.
This property represents the diameter (size) of the avatar.
-
sizeProperty
public final javafx.beans.property.DoubleProperty sizeProperty()The size property of the avatar.This property represents the diameter (size) of the avatar.
- See Also:
-
setSize
public final void setSize(double size) Sets the value of the property size.- Property description:
- The size property of the avatar.
This property represents the diameter (size) of the avatar.
-
avatarShapeProperty
The clip type property of the avatar.This property determines the shape of the avatar, whether it is circular or rectangular.
-
getAvatarShape
Gets the value of the property avatarShape.- Property description:
- The clip type property of the avatar.
This property determines the shape of the avatar, whether it is circular or rectangular.
-
setAvatarShape
Sets the value of the property avatarShape.- Property description:
- The clip type property of the avatar.
This property determines the shape of the avatar, whether it is circular or rectangular.
-
getControlCssMetaData
- Overrides:
getControlCssMetaDatain classjavafx.scene.control.Control
-
getClassCssMetaData
-