⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hintcanvas.java

📁 Programming java 2 micro edition on symbian os 一书中作者写的使用了MMAPI的小拼图游戏
💻 JAVA
字号:
/*
 * Copyright 2003, 2004 Symbian Ltd.
 * For License terms see http://www.symbian.com/developer/techlib/codelicense.html
 */

package picturepuzzle;
import javax.microedition.lcdui.*;

/**
 * Display the original (unscrambled) image as a hint to the user.
 */
public class HintCanvas extends Canvas {
    
    private Image image;
    private int posX , posY;
    private int cWidth, cHeight;
    
    public HintCanvas(Image image) {
        super();
        this.image = image;
        cWidth = getWidth();
        cHeight = getHeight();
        posX = (cWidth - image.getWidth())/2;
        posY = (cHeight - image.getHeight())/2;
    }
    
    public void paint(Graphics g) {
        g.setColor(255 , 255 , 255);//paint a white background
        g.fillRect(0 , 0 , cWidth , cHeight);
        g.drawImage(image , posX , posY , Graphics.TOP | Graphics.LEFT);
        g.setColor(0 , 0 , 255);//paint text in blue
        g.setFont(Font.getFont(Font.FACE_MONOSPACE , Font.STYLE_BOLD , Font.SIZE_SMALL));
        g.drawString("Original Image" , getWidth() / 2 , 0 , Graphics.HCENTER | Graphics.TOP);
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -