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

J2ME

开发平台:

Java

  1. package drawregiondemo;
  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 Image image;
  10.       //  private Image transimage;
  11. public ImageCanvas()
  12.         {
  13.         }
  14.         public void paint(Graphics g)
  15.         {
  16.         
  17.         g.setColor(0x00000000);
  18. g.fillRect(0, 0, this.getWidth(), this.getHeight());
  19.         try{
  20.         image = Image.createImage("/tree.png"); 
  21.         }catch(java.io.IOException e){
  22.         System.out.println(e.getMessage());
  23.         }
  24.         g.drawRegion(image,10,10,80,80,Sprite.TRANS_ROT270,100,50,g.TOP|g.HCENTER);
  25.         }
  26.        
  27.         
  28.         
  29.         
  30. }