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.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 239
Registered: ‎07-26-2010
My Device: Z10
My Carrier: Telkomsel
Accepted Solution

How to change the font of an ActiveRichTextField?

I use this:

 

int defaultTextHeight = Math.min(Display.getHeight() / 15, 20);
Font myFont = FontFamily.forName("BBAlpha Sans").getFont(Font.PLAIN, defaultTextHeight);
ActiveRichTextField labelEmail = new ActiveRichTextField("user@blahblah.com", FIELD_LEFT | FOCUSABLE);
labelEmail.setFont(myFont);

 

 

Strangely, the font isn't changed. What's wrong here?

Developer
Posts: 157
Registered: ‎03-29-2010
My Device: 8300
My Carrier: bb

Re: How to change the font of an ActiveRichTextField?

you should go to the Simulator Font and change the Font there.....Which JDE VErsion you are using and in which simulator model u r testing

Developer
Posts: 157
Registered: ‎03-29-2010
My Device: 8300
My Carrier: bb

Re: How to change the font of an ActiveRichTextField?

go to simulator Options->Screen/Keyboard0>(here try to change the Font size and Font Family

Developer
Posts: 239
Registered: ‎07-26-2010
My Device: Z10
My Carrier: Telkomsel

Re: How to change the font of an ActiveRichTextField?

Well I didn't run the code on the simulator, but directly on the device (BB Curve 8520).

Developer
Posts: 157
Registered: ‎03-29-2010
My Device: 8300
My Carrier: bb

Re: How to change the font of an ActiveRichTextField?

Hi then in ur Mobile device Go to Options->Screen/Keyboard then in this you can find the Font Family and Font Size try to change these then your font get changed

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: How to change the font of an ActiveRichTextField?

 


bb2010 wrote:

Hi then in ur Mobile device Go to Options->Screen/Keyboard then in this you can find the Font Family and Font Size try to change these then your font get changed


 

Very strange suggestion - is the developer then supposed to tell the users of his or her application to change their system defaults because of a single program which doesn't know how to deal with fonts?

 

To the original poster:

Try creating the field this way:

 

int defaultTextHeight = Math.min(Display.getHeight() / 15, 20);
Font myFont = FontFamily.forName("BBAlpha Sans").getFont(Font.PLAIN, defaultTextHeight);
String labelEmailText = "user@blahblah.com";
int[] offsets = {0, labelEmailText.length()};
Font[] fonts = {myFont};
byte[] attributes = {0};

ActiveRichTextField labelEmail = new ActiveRichTextField(labelEmailText, offsets, attributes, fonts, null, null, FIELD_LEFT | FOCUSABLE);

 The code in blue is what I added or modified in your original piece.

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 239
Registered: ‎07-26-2010
My Device: Z10
My Carrier: Telkomsel

Re: How to change the font of an ActiveRichTextField?

Thanks arkadyz. It works.
Developer
Posts: 77
Registered: ‎11-03-2009
My Device: 9810 Torch
My Carrier: VIPnet

Re: How to change the font of an ActiveRichTextField?

Have you guys seen this Bug item: https://www.blackberry.com/jira/browse/JAVAAPI-2063