I don\'t know how to apply font style to a text in a LabelField
in Blackberry
.
Here's a post which has a ResponseLabelField that extends LabelField and shows how to set the font: http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=37988
Here's a quick code snippet for you:
LabelField displayLabel = new LabelField("Test", LabelField.FOCUSABLE)
{
protected void paintBackground(net.rim.device.api.ui.Graphics g)
{
g.clear();
g.getColor();
g.setColor(Color.CYAN);
g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
g.setColor(Color.BLUE);
}
};
FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font = fontFamily[1].getFont(FontFamily.CBTF_FONT, 8);
displayLabel.setFont(font);
Someone correct me if I'm wrong, but I believe different fonts are chosen by using a different index into the fontFamily
array.
EDIT: And here's a test app you can use to switch between fonts: http://blackberry-digger.blogspot.com/2009/04/how-to-change-fonts-in-blackberry.html