ImageCanvas.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- package drawregiondemo;
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.game.*;
- import java.io.*;
- import java.lang.*;
- public class ImageCanvas extends Canvas
- {
- private Image image;
- // private Image transimage;
- public ImageCanvas()
- {
- }
- public void paint(Graphics g)
- {
- g.setColor(0x00000000);
- g.fillRect(0, 0, this.getWidth(), this.getHeight());
- try{
- image = Image.createImage("/tree.png");
- }catch(java.io.IOException e){
- System.out.println(e.getMessage());
- }
- g.drawRegion(image,10,10,80,80,Sprite.TRANS_ROT270,100,50,g.TOP|g.HCENTER);
- }
- }