Tag: RichTextField

Setting a Bold and Colorize Text

this is how to create a RichTextField with style Bold and Red color.

RichTextField rtf = new RichTextField(element,RichTextField.TEXT_ALIGN_LEFT){
  // Override the paint method to set Color.
  public void paint(Graphics graphics) {

RichTextField alignment

RichTextField have no impact with style from constant of class Field (eg: Field.FIELD_RIGHT).

You have to use constant style from RichTextField, so the code it should be like this:

contentManager.add(new RichTextField("text on left",RichTextField.TEXT_ALIGN_LEFT));
contentManager.add(new RichTextField("text on center",RichTextField.TEXT_ALIGN_HCENTER));
contentManager.add(new RichTextField("text on right",RichTextField.TEXT_ALIGN_RIGHT));

here is the reference for complete tutorial about Field on BlackBerry API
[1] http://devsushi.com/2007/12/02/blackberry-jde-api-user-interface-field-reference/

  • Copyright © 1996-2010 vaks.in. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress