Fonts in MIDP

I am going crazy trying to get fonts to work with MIDP. It appears that I have to extend the StringItem class, override the paint method and do a graphics.setFont - this sounds way too cumbersome - there has to be an easier way. Don
[259 byte] By [d1camero] at [2007-9-26 11:26:07]
# 1

My screen overrode the Canvas class (instead of Form or List) and overrode the paint method, which is passed a refererence to the graphics object:

public void paint(Graphics g) {

Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);

g.setColor(0x00000000);

g.setFont(font);

g.drawString("Hi Mom", getWidth()/2, 2, Graphics.TOP | Graphics.HCENTER);

}

d1camero at 2007-7-2 0:37:23 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
every paint event!!!that is incredibly inefficientrob,
Abuse at 2007-7-2 0:37:23 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
I do not understand your reply - can you tell me use fonts efficiently in MIDP?
d1camero at 2007-7-2 0:37:23 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
he means every time that paint method is called, the font is created. Just put the creation of the font in another method that you call once and problem is fixed...
akupers at 2007-7-2 0:37:23 > top of Java-index,Java Mobility Forums,Java ME Technologies...