05-24-2009 07:01 AM
How i can change the font of labelfield. i created a class which extends labelfield class and override the sent font method. but its not working. whats problem with this code. please help me out....
import net.rim.device.api.system.Display; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.FontFamily; import net.rim.device.api.ui.component.LabelField; public class ResponseLabelField extends LabelField{ final FontFamily fontFamily[] = FontFamily.getFontFamilies(); final Font font10 = fontFamily[0].getFont(FontFamily.CBTF_FONT, 8); public ResponseLabelField(String s, long l){ super(s, l); } /* public void setFont(Font font) { font = font10; super.setFont(font); }*/ 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); } public void setFont(Font font) { FontFamily fontFamily[] = FontFamily.getFontFamilies(); font = fontFamily[3].getFont(FontFamily.CBTF_FONT, 14); super.setFont(font); } public void setMargin(int arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub super.setMargin(9, 9, 9, 9); } }
Solved! Go to Solution.
05-24-2009 09:09 AM - edited 05-24-2009 09:17 AM
Modify your constructor -like this,
public ResponseLabelField(String s, long l){
super(s, l);
setFont(font10);
}
or after creating instance of ResponseLabelField you can call setFont method as it is public.
06-03-2009 01:06 PM
This is my first ever project developed using RIM Apis. I will try to create a separate project using JDE and let you know how that goes.
Thanks..
Regards,
-DK