Word hyphenation with Label

ui

#1

Hi,

Is it possible to have hyphenation (“words split”) with Labels if there is no room to display text on screen ?

Do I need to develop a custom widget ?

Thank you.


#2

Hi @cgorand,

You have two choices:

  • Using the ComplexTextManager as a style of your Label [1]
  • Creating your own Label widget and using TextHelper to split texts on spaces [2]

If you have simple needs the first solution is the easiest.

Gaëtan for MicroEJ

[1] https://developer.microej.com/javadoc/microej_4.1/addons/ej/style/text/ComplexTextManager.html
[2] https://developer.microej.com/javadoc/microej_4.1/addons/ej/style/text/TextHelper.html


#3

Charles,

You can also look at the Widget demo example for line wrap [1] - see screenshot below.
scrollableText
[1] https://github.com/MicroEJ/Demo-Widget/blob/master/com.microej.demo.widget/src/main/java/com/microej/demo/widget/page/ScrollableTextPage.java

Stéphane, MicroEJ.


#4

Hi,

Thank you for your answers. ComplexTextManager does the job !