Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
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);
 line2.setFont(fonts[0]);
        
 VerticalFieldManager vfmSubHead = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH | Field.NON_FOCUSABLE);
 vfmSubHead.add(line1);
 vfmSubHead.add(line2);

 

 

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.

 

Cheers,

Neil.