07-15-2008 07:05 AM
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?
Solved! Go to Solution.
07-15-2008 07:14 AM
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.