Skip to content

How to set different styles to words in same paragraph or line ? #406

@nazmuddin

Description

@nazmuddin

Hi , i have two queries.

  1. How to set different styles to words in same paragraph or line of GenericStyledArea ? I am doing it like this ....

area.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color));

This works only for first word, but when i append the second word with different style like

area.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color).updateBold(true);
It also changes the style of first text. Now how to do it ?

  1. How to add different objects in same GenericStyledArea . What i mean to say is if i define the area like this
    final GenericStyledArea<ParStyle, Either<StyledText<TextStyle>, LinkedImage<TextStyle>>, TextStyle> area .
    I can insert only LinkedImage objects into this. But if i have to add lets say an Text or Hyperlink Object then how to do it. I can manage the hyperlink with styling as you explained in some pull request but if i have to add Hyperlink and Image in area then how to do it ?
    Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions