Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange Font Error

 
Steven Mann
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a Blackberry app (Java ME). I have the following code written for drawing a custom titlebar:


when executed, I get the following error:
setFont(net.rim.device.api.ui.Font) in net.rim.device.api.ui.Graphics cannot be applied to (int)

when i remove the setfont line, it works fine. Googled for awhile, got nowhere. What am I doing wrong?

regards
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Steven Mann
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does that use net.rim.device.api.ui.Font?

I'm getting this error now: setFont(net.rim.device.api.ui.Font) in net.rim.device.api.ui.Graphics cannot be applied to (javax.microedition.lcdui.Font)

It obviously won't let me load the Javax and net.rim font packages at the same time. My problem is that I need javax to get the string width. Is there anyway to use javax instead?

regards


 
Ashish Bhandurge
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

try this , it will work.

private static final int FACE_PROPORTIONAL=64;
private static final int STYLE_ITALIC = 2;
private static final int STYLE_BOLD= 1;
private static final int SIZE_LARGE= 16;

graphics.setFont(Font.getFont(FACE_PROPORTIONAL, STYLE_ITALIC|STYLE_BOLD, SIZE_LARGE));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic