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
Developer
Posts: 108
Registered: ‎01-29-2009
My Device: BlackBerry 8700g
My Carrier: Tigo
Accepted Solution

Format BOLD for fields

Hi Team,

 

I have the following screen.

I need format the "status" and  "First Aware" fields with format BOLD. I need only word "Status" not the word "Taken"



I have a next code:

 

/** Format for the text  */
        Font font_bold_title = this.getFont().derive(Font.BOLD);

_first_aware_title.setFont(font_bold_title); 

_status_title.setFont(font_bold_title);

 

add(_firstAwareField);

add(_status);

 

Any Sugestions?

Jorge Luis Frias B

Leader on Development
BlackBerry/iPhone Technologies
Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Format BOLD for fields

I can think of two Options, assuming the data is read only:

 

1) have 'Status' and 'taken' in different Fields, say LabelFields, each with different Fonts.  You will have to work with FlowFieldManager or HoriizontalFieldManager to get the Fields next to each other.

 

2) Use RichTextField (or extending) class,

 

Personally I would go with RichTextField.

 

If on the other hand the 'Taken' Field is an input Field, then I think you will need to go with two Fields, with the 'taken' Field being an EditField with no Label.

Developer
Posts: 108
Registered: ‎01-29-2009
My Device: BlackBerry 8700g
My Carrier: Tigo

Re: Format BOLD for fields

Hi guys,

 

I need create the following format:

 

Field A:   field b

 

where, Field A is bold. Field A and field b are in the same row.

 

 

I have the following code:

 

final class DecorDemoScreen extends MainScreen
{
     private HorizontalFieldManager test;
 
  
    DecorDemoScreen()
    {
       test = new HorizontalFieldManager();
       
        try
        {
          test.setBorder(BorderFactory.createBitmapBorder(new XYEdges(14,14,14,14), Bitmap.getBitmapResource("box.png"))); 
        }
        catch (IllegalArgumentException e)
        {
           System.out.println(e.getMessage());
        }
      
       Font font_bold_title = this.getFont().derive(Font.BOLD);
      
        
       RichTextField simpleField5a = new RichTextField("5a - ");
       RichTextField simpleField5b = new RichTextField("5b");
      
    simpleField5a.setFont(font_bold_title);

       add(test);

       test.add(simpleField5a);
       test.add(simpleField5b);
    }
}



But this code have any errors, I can´t see the field b. Any suggestions? Please...

 

Jorge Luis Frias B

Leader on Development
BlackBerry/iPhone Technologies
BlackBerry Development Advisor
Posts: 15,021
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Format BOLD for fields

Please refer to this sample.

 

How To - Format text in a RichTextField
Article Number: DB-00124

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker