Class LinearComponents


  • public final class LinearComponents
    extends java.lang.Object
    A utility class that allows components to be created where styles can be specified inline.
    Since:
    4.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull Component linear​(@NotNull ComponentBuilderApplicable @NotNull ... applicables)
      Styles apply to all components after them until a conflicting style is discovered
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • linear

        @NotNull
        public static @NotNull Component linear​(@NotNull
                                                @NotNull ComponentBuilderApplicable @NotNull ... applicables)
        Styles apply to all components after them until a conflicting style is discovered
             Component message = LinearComponents.linear(NamedTextColor.RED, translatable("welcome.message"), TextDecoration.BOLD, text(" SERVER));
           
        In this example all the text is red, but only the last word is bold.
             Component message = LinearComponents.linear(NamedTextColor.GREEN, text("I am green. "), NamedTextColor.GRAY, text("I am gray."));
           
        In this example, the first text is green and the second is gray.
        Parameters:
        applicables - the things used to make the component
        Returns:
        a component
        Since:
        4.0.0