How to use freely resizable font in in Java ME(6)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:34 点击:次
buttonFontHeight = font.getHeight();
g.setFont(font);
this.w = font.stringWidth(text)+ 10;
g.setColor(255, 0, 0);
g.drawRect(x, y, w, h);
if (selected) g.setColor(0, 0, 255);
g.drawRect(x-1, y-1, w+2, h+2);
g.setColor(0, 0, 0);
g.drawString(text, x+w/2, y+h/2-buttonFontHeight/2, Graphics.TOP|Graphics.HCENTER);
edge = x + w;
return edge;
}
}
}
In the screenshots below font sizes of 12, 30 and 50 pixels have been used.
There are also the FontSizingMIDlet.jad and FontSizingMIDlet.jar files available here.
[edit]
Example application
FontSizingMIDlet.zip containing FontSizingMIDlet.jad and FontSizingMIDlet.jar
[edit]
See also
How to retrieve version number of Java Runtime for S60
相关新闻>>
- 发表评论
-
- 最新评论 更多>>