📄 fontcanvas.java
字号:
package FontDemo;
import javax.microedition.lcdui.*;
class FontCanvas extends Canvas {
FontCanvas() {
}
void init() {
}
void destroy() {
}
protected void paint(Graphics g) {
g.setColor(0x001169ee);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
String title = "系统";
int height = 0;
int currentFace = Font.FACE_SYSTEM;
g.setColor(0x00ffffff);
g.drawString(title, 0, 0, Graphics.TOP|Graphics.LEFT);
height += g.getFont().getHeight();
g.setFont(Font.getFont(currentFace,
Font.STYLE_PLAIN,
Font.SIZE_LARGE));
g.drawString("系统 常规 加大", 0, height, Graphics.TOP|Graphics.LEFT);
height += g.getFont().getHeight();
g.setFont(Font.getFont(currentFace,
Font.STYLE_ITALIC,
Font.SIZE_LARGE));
g.drawString("系统 倾斜 加大", 0, height, Graphics.TOP|Graphics.LEFT);
height += g.getFont().getHeight();
g.setFont(Font.getFont(currentFace,
Font.STYLE_BOLD,
Font.SIZE_LARGE));
g.drawString("系统 加粗 加大", 0, height, Graphics.TOP|Graphics.LEFT);
height += g.getFont().getHeight();
g.setFont(Font.getFont(currentFace,
Font.STYLE_BOLD|Font.STYLE_ITALIC,
Font.SIZE_LARGE));
g.drawString("系统 加粗 倾斜 加大", 0, height, Graphics.TOP|Graphics.LEFT);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -