ImageCanvas.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- package mutableimagedemo;
- 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 Graphics g;
- public int type = 0;
- private Image image;
- public ImageCanvas()
- {
- }
- public void paint(Graphics g)
- {
- g.setColor(0x00000000);
- g.fillRect(0, 0, this.getWidth(), this.getHeight());
- image = Image.createImage(100,100);
- Graphics image_G = image.getGraphics();
- image_G.setColor(0xFF0000);
- image_G.fillRect(25,25,50,50);
- g.drawImage(image,getWidth()/2,getHeight()/2,g.VCENTER|g.HCENTER);
- }
- }