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: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

how to bold text?

hi, i know that i can simply bold text using Font and FontFamily, par example:

FontFamily _fontFamily; Font _font; try{ _fontFamily = FontFamily.forName(_fontName); _font = _fontFamily.getFont(FontFamily.SCALABLE_FONT, _fontSize).derive(Font.BOLD); LabelField _field = new LabelField(); _field.setFont(_font); }catch(Exception e){ }

and now, text that appears on the _field will be bold. but i would like to write a method that will bold the string.. par example: i want to add some text to the field, but i do not want all of it to be bold, only some, which i'll choose. is it possible to bold a string? so that i could then add to the field bolded (or not) stirng?



 kind regards


Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: how to bold text?

I am not really sure if it is possible to bold any string without adding any field.


But you can use RichTextField to format text with different fonts.


How To - Format text in a RichTextField




Posts: 17,024
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: how to bold text?

the setFont is called for the whole field, there is no way to have it only for your string.
i don't think you can easily implement this behaviour by overwriting paint, best use a field where it is already implemented as bikas suggested.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: how to bold text?

I had the same link to post here which bikas suggested, before my lunch.. Agree with the above two posters..



Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group