Class Label

    • Constructor Detail

      • Label

        public Label()
        Creates a new empty label.
      • Label

        public Label​(String text)
        Creates a new label with the given text content.
        Parameters:
        text - the text content
    • Method Detail

      • setFor

        public void setFor​(Component forComponent)
        Sets the component that this label describes. The component (or its id) should be defined in case the described component is not an ancestor of the label.

        The provided component must have an id set. This component will still use the old id if the id of the provided component is changed after this method has been called.

        Parameters:
        forComponent - the component that this label describes, not null , must have an id
        Throws:
        IllegalArgumentException - if the provided component has no id
      • setFor

        public void setFor​(String forId)
        Sets the id of the component that this label describes. The id should be defined in case the described component is not an ancestor of the label.
        Parameters:
        forId - the id of the described component, or null if there is no value
      • getFor

        public Optional<String> getFor()
        Gets the id of the component that this label describes.
        Returns:
        an optional id of the described component, or an empty optional if the attribute has not been set
        See Also:
        setFor(String)