How to use freely resizable font in in Java ME(3)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:34 点击:次
g.setColor(255, 255,255);
g.fillRect(0, 0, width, height);
g.setColor(0, 0, 0);
font = DirectUtils.getFont(face, style, fontHeight);
fontHeight = font.getHeight();
g.setFont(font);
g.drawString(heightString, 0, 0, Graphics.TOP|Graphics.LEFT);
g.drawString(fontString, 0, fontHeight, Graphics.TOP|Graphics.LEFT);
g.drawString("com.nokia.mid.ui.version: " + System.getProperty("com.nokia.mid.ui.version"),
0, fontHeight*2, Graphics.TOP|Graphics.LEFT); // Should return "1.2"
edge = plusButton.drawButton(g, 10, height-70, plusButton.selected);
edge = minusButton.drawButton(g, edge+10, height-70, minusButton.selected);
edge = styleButton.drawButton(g, edge+10, height-70, styleButton.selected);
if (!init) {
plusButton.registerFeedbackArea(this, 0);
minusButton.registerFeedbackArea(this, 1);
styleButton.registerFeedbackArea(this, 2);
init = true; // initialization done
}
}
protected void keyPressed(int keyCode) {
if (keyCode == -2 || keyCode == -3) {
if (fontHeight > 0) fontHeight--;
}
else if (keyCode == -1 || keyCode == -4) fontHeight++;
repaint(0, 0, width, fontHeight*3+2);
}
protected void keyReleased(int keyCode) { }
protected void keyRepeated(int keyCode) {
if (keyCode == -2 || keyCode == -3) {
if (fontHeight > 0) fontHeight--;
}
else if (keyCode == -1 || keyCode == -4) fontHeight++;
repaint(0, 0, width, fontHeight*3+2);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>