BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 09-11-2007, 03:04 AM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: student
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default @JDE - How to set the text size

Please Login to Remove!

Hi Everybody,

Can tell me everybody how to set the text size?

In Eclipse-Jave i use:
new Font(Display.getDefault(), "Times New Roman", 18, SWT.ITALIC)

Thanks for every answer.
Greetings speedo
Offline  
Old 09-11-2007, 03:58 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
String fontName;
FontFamily ff; 
int fontSize;
Font font;

fontName="BBClarity";
fontSize=12;
ff = FontFamily.forName(fontName);               
font = ff.getFont(FontFamily.SCALABLE_FONT, fontSize).derive(Font.PLAIN);               
Font.setDefaultFont(font);
hth,
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 09-11-2007, 09:59 AM   #3 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: student
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help simon, i have tryed to paint two different text-size's but the program close and it shot this message:

Uncaught exception:
Application GebPlaner(118) is not responding; process terminated

My Code to paint two different text-size's:

protected void paint(Graphics graphics){
try{
String fontName;
FontFamily ff;
int fontSize;
Font font;
fontSize=12;

fontName="BBMillbankTall";
ff = FontFamily.forName(fontName);
font = ff.getFont(FontFamily.SCALABLE_FONT, fontSize).derive(Font.BOLD);
Font.setDefaultFont(font);
graphics.drawText("BBMillbankTall",1,60);

fontSize=9;

fontName="BBMillbankTall";
ff = FontFamily.forName(fontName);
font = ff.getFont(FontFamily.SCALABLE_FONT, fontSize).derive(Font.BOLD);
Font.setDefaultFont(font);
graphics.drawText("BBMillbankTall",1,80);

}catch(Exception e){}
}
Offline  
Old 09-11-2007, 10:22 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

if you're using this method you'd use:

graphics.setFont(font);
graphics.drawText("myText", 0, 0);

but why are you overriding a paint method? are you creating your own interface?

you can just set the font of any field:

LabelField myLabelField = new LabelField("Hello World");
myLabelField.setFont(myFont());
add(myLabelField);
.
.
.
public static Font myFont() {
try {
FontFamily theFam = FontFamily.forName("SYSTEM");
return theFam.getFont(net.rim.device.api.ui.Font.PLAIN, 14);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return null;
}
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 09-12-2007, 02:44 AM   #5 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100T
PIN: N/A
Carrier: student
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thank you. Now it functions marvelously.



ff = FontFamily.forName("BBMillbankTall");
font = ff.getFont(FontFamily.SCALABLE_FONT, 12).derive(Font.BOLD);
LabelField lf_4 = new LabelField("BBMillbankTall - Size:12");
lf_4.setFont(font);
add(lf_4);
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Johnson Controls P67AA-1C P67AA-1 Pressure Electric 3-30 psig 1/8 male barbed
$14.75
Johnson Controls P67AA-1C  P67AA-1 Pressure Electric 3-30 psig 1/8 male barbed pictureJOHNSON CONTROLS A99BB-25C SILICON PTC TEMP. SENSOR *NEW IN FACTORY BAG*
$23.0
JOHNSON CONTROLS A99BB-25C SILICON PTC TEMP. SENSOR *NEW IN FACTORY BAG* pictureJohnson Controls Differential Pressure Unit P74FA-1C
$95.0
Johnson Controls Differential Pressure Unit P74FA-1C pictureJohnson Controls G891TCA-8103 ignition board lennox pulse
$100.0
Johnson Controls G891TCA-8103 ignition board lennox pulse  pictureJohnson Controls Penn A419 Electronic Temperature Control UNTESTED AS IS READ
$29.99
Johnson Controls Penn A419 Electronic Temperature Control UNTESTED AS IS READ picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.