Class Message

  • Direct Known Subclasses:
    Snackbar, Toast

    public abstract class Message
    extends Object
    Message provide lightweight feedback about an operation. They are displayed at the bottom of the screen and disappear automatically. Developers are advised to use a duration of either LENGTH_SHORT or LENGTH_LONG which corresponds to 2 and 3.5 seconds respectively.

    There are two types of Message:

    • Snackbar - Messages related to an action performed.
    • Toast - Messages related but not restricted to system updates.
    Since:
    5.0.0
    See Also:
    Snackbar, Toast
    • Property Detail

      • id

        public final StringProperty idProperty
        The id of this Message. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).

        For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows: scene.lookup("#myId");.

        Default value:
        null
        See Also:
        getId(), setId(String)
    • Field Detail

      • LENGTH_SHORT

        public static final Duration LENGTH_SHORT
        A short amount of time to display the message - 2000 ms.
      • LENGTH_LONG

        public static final Duration LENGTH_LONG
        A long amount of time to display the message - 3500 ms.
    • Constructor Detail

      • Message

        public Message()
    • Method Detail

      • setMessage

        public final void setMessage​(String text)
        Sets the value of the property message.
        Property description:
        The message to display.
      • getMessage

        public final String getMessage()
        Gets the value of the property message.
        Property description:
        The message to display.
      • setDuration

        public final void setDuration​(Duration duration)
        Sets the value of the property duration.
        Property description:
        The time the Message is shown.
      • getDuration

        public final Duration getDuration()
        Gets the value of the property duration.
        Property description:
        The time the Message is shown.
      • idProperty

        public final StringProperty idProperty()
        The id of this Message. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).

        For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows: scene.lookup("#myId");.

        Default value:
        null
        See Also:
        getId(), setId(String)
      • setId

        public final void setId​(String id)
        Sets the value of the property id.
        Property description:
        The id of this Message. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).

        For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows: scene.lookup("#myId");.

        Default value:
        null
      • getId

        public final String getId()
        Gets the value of the property id.
        Property description:
        The id of this Message. This simple string identifier is useful for finding a specific Message within the scene graph. While the id of a notification should be unique within the scene graph, this uniqueness is not enforced. This is analogous to the "id" attribute on an HTML element (CSS ID Specification).

        For example, if a notification is given the id of "myId", then the lookup method can be used to find this notification as follows: scene.lookup("#myId");.

        Default value:
        null
      • show

        public abstract void show()
        Shows the Message immediately, if no other message is showing. If a message is already showing, it gets added to the waiting queue and will show when its turn arrives.
      • cancel

        public abstract void cancel()
        If the Message is currently showing, calling this method will hide it immediately and show the next Message in queue. If the Message is waiting in the queue, calling this method removes the Message from the queue and the Message is never shown.