📄 alertcanvas.java
字号:
package edu.neu.aatk.canvas;
import java.io.IOException;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import edu.neu.aatk.AATK;
public class AlertCanvas extends AATKCanvas {
private Image img = null;
private String note = null;
private String info = null;
public AlertCanvas(String title, AATK aatk,
Image img, String note, String info) {
super(title, aatk);
this.img = img;
this.note = note;
this.info = info;
}
protected void paint(Graphics g) {
super.paint(g);
paintLeftCommand(g, "返回");
try {
paintImage(g, img);
}
catch(Exception e) {
e.printStackTrace();
}
paintNote(g, note);
paintInfo(g, info);
}
private void paintImage(Graphics g, Image img) {
g.drawImage(img, 10, 40, Graphics.TOP | Graphics.LEFT);
}
private void paintNote(Graphics g, String note) {
Font font = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD,
Font.SIZE_LARGE);
g.setFont(font);
g.setColor(0, 0, 0);
g.drawString(note, 80, 65, Graphics.TOP | Graphics.LEFT);
}
private void paintInfo(Graphics g, String info) {
Font font = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN,
Font.SIZE_LARGE);
g.setFont(font);
g.setColor(0, 0, 0);
g.drawString(info, 20, 140, Graphics.TOP | Graphics.LEFT);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -