ImageCanvas.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package mutableimagedemo;
  2. import javax.microedition.lcdui.*;
  3. import javax.microedition.midlet.*;
  4. import javax.microedition.lcdui.game.*;
  5. import java.io.*;
  6. import java.lang.*;
  7. public class ImageCanvas extends Canvas
  8. {
  9. //private Graphics g;
  10. public int type = 0;
  11. private Image image;
  12. public ImageCanvas()
  13.         {
  14.         }
  15.         public void paint(Graphics g)
  16.         {
  17.         g.setColor(0x00000000);
  18. g.fillRect(0, 0, this.getWidth(), this.getHeight());
  19. image = Image.createImage(100,100);
  20. Graphics image_G = image.getGraphics();
  21. image_G.setColor(0xFF0000);
  22. image_G.fillRect(25,25,50,50);
  23. g.drawImage(image,getWidth()/2,getHeight()/2,g.VCENTER|g.HCENTER);
  24.         }
  25. }