Search code examples
blackberryjava-meblackberry-jde

Multiline labelfield


I must show a string that can or not be large enough to not fit in one line in all devices, I want labelfield control to automatically show remaining text in a "new line" after the original one, I mean like... auomatic carret return if the string cannot be showed in a single line, all mobile OS I have tried do this, but I cannot make BB OS to work, it just truncates my string whenever it likes and it's very annoying.

Thank you


Solution

  • One way to do this is put your HorizontalFieldManager that contains the LabelField inside a VerticalFieldManager.

    E.g.

    LabelField labelField = new LabelField("This is a very long sentance that I have written to show that the text will wrap around when it gets to the edge of the field.");
    VerticalFieldManager vfm = new VerticalFieldManager();
    HorizontalFieldManager hfm = new HorizontalFieldManager();
    hfm.add(labelField);
    vfm.add(hfm);
    
    add(vfm);