This means that if the color is set for both a child and parent text component, the child's color will be displayed. When applying a parent text component's Style to its children text components, a non-null property of a child Style will take precedence over its parent Style. This will merge the BLUE color with the existing Style object. To add a light blue color for example, one could simple call theTextComponent.withStyle(TextFormatting.BLUE). By default, text components use a style of Style.EMPTY, with an empty color representing white and empty properties meaning no special text formatting. withStyle modifies the existing Style object with the given property, while setStyle replaces the current Style object. A style can be applied to a text component by calling withStyle and setStyle. In reality, these "siblings" are actually children of the main text component, and are treated as such when formatting with the Style object. Text components at their most basic level hold a Style object and a list of "sibling" text components named siblings.
0 Comments
Leave a Reply. |