Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified
Accepted Solution

Right Justify a RichTextField??

I can't seem to get a RTF to right justify!


 int[] offsets = { 0, 12, subHeadStr1.length() };
 byte[] attributes = { 0, 1 };
 RichTextField line1 = new RichTextField(subHeadStr1, offsets, attributes, fonts, RichTextField.NON_FOCUSABLE | RichTextField.FIELD_RIGHT);

 LabelField line2 = new LabelField(subHeadStr2, Field.NON_FOCUSABLE | Field.FIELD_RIGHT);
 VerticalFieldManager vfmSubHead = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH | Field.NON_FOCUSABLE);



The "line2" LabelField gets right justified just fine, but not the RTF.


Any suggestions?


New Developer
Posts: 11
Registered: ‎07-14-2008
My Device: Not Specified

Re: Right Justify a RichTextField??

Please note I haven't tested this myself so this might just be a red-herring but looking at the documentation for RichTextField there are a number of static constants defined, one of which is TEXT_ALIGN_RIGHT. Any luck using this in place of FIELD_RIGHT?


Also, sometimes you can use DrawStyle constants. So if TEXT_ALIGN_RIGHT doesn't work try DrawStyle.RIGHT


Let me know how it goes.