Record Class TextFragmentWidget

java.lang.Object
java.lang.Record
dev.pfaff.altargui.widgets.TextFragmentWidget
Record Components:
font - the value may be null while the font is loading
color - text colorRgba (ARGB)
flags - StyleFlags
All Implemented Interfaces:
Widget, LeafWidget, TextWidget

public record TextFragmentWidget(CharProvider characters, @NonNull Value<? extends @Nullable Font> font, int color, int flags, Value<Float> fontSize) extends Record implements TextWidget, LeafWidget
A widget that displays a segment of uniformly-styled text.
  • Constructor Details

    • TextFragmentWidget

      @Deprecated public TextFragmentWidget(CharProvider characters, @NonNull Value<? extends @Nullable Font> font, int color, int flags, Value<Float> fontSize)
      Deprecated.
      Creates an instance of a TextFragmentWidget record class.
      Parameters:
      characters - the value for the characters record component
      font - the value for the font record component
      color - the value for the color record component
      flags - the value for the flags record component
      fontSize - the value for the fontSize record component
    • TextFragmentWidget

      public TextFragmentWidget(CharProvider characters, @NonNull Value<? extends @Nullable Font> font, Color color, int flags, Value<Float> fontSize)
    • TextFragmentWidget

      public TextFragmentWidget(CharProvider characters, @NonNull Value<? extends @Nullable Font> font)
    • TextFragmentWidget

      public TextFragmentWidget(char character, @NonNull Value<? extends @Nullable Font> font)
    • TextFragmentWidget

      public TextFragmentWidget(String string, @NonNull Value<? extends @Nullable Font> font)
  • Method Details

    • withFont

      public TextWidget withFont(Value<? extends @Nullable Font> font)
      Specified by:
      withFont in interface TextWidget
    • withFontSize

      public TextWidget withFontSize(Value<Float> fontSize)
      Specified by:
      withFontSize in interface TextWidget
    • withColor

      public TextFragmentWidget withColor(Color color)
      Specified by:
      withColor in interface TextWidget
    • mapFlags

      public TextFragmentWidget mapFlags(IntUnaryOperator modifier)
      Specified by:
      mapFlags in interface TextWidget
    • withFlags

      public TextFragmentWidget withFlags(int flags)
      Specified by:
      withFlags in interface TextWidget
    • withBold

      public TextFragmentWidget withBold(boolean bold)
      Specified by:
      withBold in interface TextWidget
    • withItalic

      public TextFragmentWidget withItalic(boolean italic)
      Specified by:
      withItalic in interface TextWidget
    • withStrike

      public TextFragmentWidget withStrike(boolean strike)
      Specified by:
      withStrike in interface TextWidget
    • withUnderline

      public TextFragmentWidget withUnderline(boolean underline)
      Specified by:
      withUnderline in interface TextWidget
    • instantiate

      public @NonNull WidgetInstance<TextFragmentWidget> instantiate(WidgetInstantiationArgs args)
      Description copied from interface: Widget
      Instantiates an instance of the widget.
      Specified by:
      instantiate in interface Widget
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • characters

      public CharProvider characters()
      Returns the value of the characters record component.
      Returns:
      the value of the characters record component
    • font

      public @NonNull Value<? extends @Nullable Font> font()
      Returns the value of the font record component.
      Returns:
      the value of the font record component
    • color

      public int color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • flags

      public int flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • fontSize

      public Value<Float> fontSize()
      Returns the value of the fontSize record component.
      Specified by:
      fontSize in interface TextWidget
      Returns:
      the value of the fontSize record component