开发者

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

开发者 https://www.devze.com 2023-02-06 09:50 出处:网络
I am new to BB application. I want customized the size for the button text and label 开发者_如何学Ctext.

I am new to BB application. I want customized the size for the button text and label 开发者_如何学Ctext.

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.


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?


just in the above try block donot declere the statement setFont(appFont), this sets the font of the whole screen. Insead set the font by specifying which label or button you want to set the font like

LabelField lf1 = new LabelField("Testing");
lf1.setFont(appFont);

Again

ObjectChoiceField ocf1 = new ObjectChoiceField("","","");
ocf1.setFont(appFont);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号