Simple
Simple

Reputation: 865

Coloring a substring in a SpanLabel Codename one

It seems SpanLabel label = new SpanLabel("<html>Text color: <font color='red'>red</font></html>"); doesn't work in the SpanLabel of Codename One, and label.getAllStyles().setFgColor(0x0000ff); is not my case, I want to get the same result of the first example, coloring a specific word. How to do it in Codename One?

Upvotes: 1

Views: 60

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

We don't support that. This would mean parsing HTML for every widget which is something Swing can do because it has desktop processing power but doing this on a mobile phone would be painfully slow.

You have two option:

  • Use BrowserComponent and HTML - this makes sense if you have a larger body of text but won't work well for many smaller entries

  • Use something like this

Upvotes: 1

Related Questions