Hi I just started to write the blog about BlackBerry application development, i developed lot of codes to use in applications. the are as utilities and i used those codes to achieve the Customization for a better look and feel in applications . feel free always to use these codes. you can just copy and past these codes and use the class in yours code according to your need of customization.
you need to download just the Insight_screen_Bold.ttf" and Insight_screen_Regular.ttf file and put them in yours resource folder :)
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.FontFamily;
import net.rim.device.api.ui.FontManager;
public class FontDetails {
Font font;
FontFamily fontFamily;
public FontDetails() {
}
//Insight_screen_Regular
public Font retrieveFont(int x) {
if (FontManager.getInstance().load("Insight_screen_Regular.ttf", "Insight_screen_Regular", FontManager.APPLICATION_FONT) == FontManager.SUCCESS)
{
try
{
fontFamily = FontFamily.forName("Insight_screen_Regular");
font = fontFamily.getFont(Font.PLAIN, x);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage());
}
}
return font;
}
//Insight_screen_Bold
public Font retrieveFontBold(int x) {
if (FontManager.getInstance().load("Insight_screen_Bold.ttf", "Insight_screen_Bold", FontManager.APPLICATION_FONT) == FontManager.SUCCESS)
{
try
{
fontFamily = FontFamily.forName("Insight_screen_Bold");
font = fontFamily.getFont(Font.PLAIN, x);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage());
}
}
return font;
}
//normal fonts
public Font retrieveFontNormal(int x) {
try {
fontFamily = FontFamily.forName("Arial");
font = fontFamily.getFont(Font.PLAIN, x);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return font;
}
}
you need to download just the Insight_screen_Bold.ttf" and Insight_screen_Regular.ttf file and put them in yours resource folder :)
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.FontFamily;
import net.rim.device.api.ui.FontManager;
public class FontDetails {
Font font;
FontFamily fontFamily;
public FontDetails() {
}
//Insight_screen_Regular
public Font retrieveFont(int x) {
if (FontManager.getInstance().load("Insight_screen_Regular.ttf", "Insight_screen_Regular", FontManager.APPLICATION_FONT) == FontManager.SUCCESS)
{
try
{
fontFamily = FontFamily.forName("Insight_screen_Regular");
font = fontFamily.getFont(Font.PLAIN, x);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage());
}
}
return font;
}
//Insight_screen_Bold
public Font retrieveFontBold(int x) {
if (FontManager.getInstance().load("Insight_screen_Bold.ttf", "Insight_screen_Bold", FontManager.APPLICATION_FONT) == FontManager.SUCCESS)
{
try
{
fontFamily = FontFamily.forName("Insight_screen_Bold");
font = fontFamily.getFont(Font.PLAIN, x);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage());
}
}
return font;
}
//normal fonts
public Font retrieveFontNormal(int x) {
try {
fontFamily = FontFamily.forName("Arial");
font = fontFamily.getFont(Font.PLAIN, x);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return font;
}
}
Please send your valuable suggestions and send the mails at upadhyay.jitesh@gmail.com
No comments:
Post a Comment