Search code examples
blackberryblackberry-widgets

How to customize the button and label text size for each field separately in blackberry application?


I am new to BB application. I want customized the size for the button text and label text.

I am using this code

try {
            FontFamily alphaSansFamily = FontFamily.forName("BBAlpha Serif");
            Font appFont = alphaSansFamily.getFont(Font.PLAIN, 9, Ui.UNITS_pt);
            setFont(appFont);
            } catch (ClassNotFoundException e) {
            }

but using this it will change size for what all the field we are using within the constructor.But I need different size for different field .Like Title will be big size and other label text button text will be small size.


Solution

  • I am guessing that you are calling that when you are creating the screen so the setFont() changes the font for the full screen.

    You can call set font on the required button or label and it will change the font only for that field e.g button.setFont(yourFont)

    Are you calling setFont() explicitly on the Field you wish to change?