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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
misty83
Posts: 745
Registered: ‎01-04-2009

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

 

Please use plain text.
Developer
bikas
Posts: 984
Registered: ‎02-10-2009

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
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

 

Regards

Bikas

Please use plain text.
Developer
simon_hain
Posts: 14,035
Registered: ‎07-29-2008
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
Please use plain text.
Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008

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..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Please use plain text.