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

📄 imagenamebox.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.*;

/**
 * A TextBox for the user to enter a name for the newly captured image.
 */
public class ImageNameBox extends TextBox implements CommandListener {
    
    private GameMIDlet midlet;
    private byte[] data;
    private Command saveCommand;
    
    public ImageNameBox(GameMIDlet midlet, byte[] data) {
        super("Enter image name", "", 20, TextField.ANY);
        this.midlet = midlet;
        this.data = data;
        saveCommand = new Command("Save" , Command.SCREEN , 2);
        setCommandListener(this);
        addCommand(saveCommand);
    }
    
    /**
     * Saves new image to store and starts the game in response to "Save" command.
     * @param command
     * @param displayable
     */
    public void commandAction(Command command , Displayable displayable) {
        if (command == saveCommand) {
            //Should check that image name hasn't already been used!
            midlet.saveImage(getString(), data);
            midlet.displayPuzzleCanvas(data);
        }
    }
    
}

⌨️ 快捷键说明

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