O'Reilly logo

BlackBerry Java Application Development by Bill Foust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - creating a RichTextField

  1. Add the following code to the createFields method of the FieldSampler application.
    Font someFont; try { someFont = FontFamily.forName("BBClarity").getFont(FontFamily.SCALABLE_FONT,10); } catch (ClassNotFoundException e) { someFont = Font.getDefault(); } Font fonts[] = new Font[5]; fonts[0] = Font.getDefault(); fonts[1] = Font.getDefault().derive(Font.BOLD); fonts[2] = Font.getDefault().derive(Font.UNDERLINED); fonts[3] = Font.getDefault().derive( Font.ITALIC); fonts[4] = someFont; byte attributes[] = new byte[8]; int offsets[] = new int[9]; // must always start the offset at 0 offsets[0] = 0; attributes[0] = 0; // Default font // The next change will happen at offset 2 // for the word 'RichTextField' offsets[1] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required