TranslateCanvas.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- package Translate;
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.*;
- import java.io.*;
- public class TranslateCanvas extends Canvas
- {
- public TranslateCanvas()
- {
- }
- public void paint(Graphics g)
- {
- int width = getWidth();
- int height = getHeight();
- g.setColor(0xFFFFFF);
- g.fillRect(0,0,width,height);
- g.setColor(0x000000);
- int n = 6;
- int deltaX = width/n;
- int deltaY = height/n;
- for(int i=0; i<n; i++) {
- g.fillRect(0,0,deltaX,deltaY);
- g.translate(deltaX, deltaY);
- System.out.println("原点坐标: "+g.getTranslateX()+", "+g.getTranslateY());
- }
- }
- }