我可以问一些技巧,使用Canvas将图像打印成圆形吗?我的代码不起作用请帮帮我..谢谢,顺便说一下我在J2ME开发手机中使用Canvas应用
以下代码是创建圆形而非导入图像的示例。
private MigoMidlet migoMidlet;
public Circle(MigoMidlet migoMidlet) {
this.migoMidlet = migoMidlet;
System.out.println("PASOK!!!!!!!!!!");
}
protected void showNotify() {
// TODO Auto-generated method stub
super.showNotify();
}
protected void paint(Graphics g) {
System.out.println("PASOK!!!!!!!!!! 11111111");
int width = getWidth();
int height = getHeight();
g.setColor(255, 255, 255);
g.fillRect(0, 0, width, height);
g.setColor(255, 0, 0);
g.drawArc(0, 0, width, height, 0, 360);
}
protected void keyPressed(int arg0) {
// TODO Auto-generated method stub
super.keyPressed(arg0);
System.out.println("repaint");
repaint();
}
答案 0 :(得分:0)