📄 capturecanvas.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 Canvas for rendering the output of the VideoPlayer. Also handles the user
* interaction to take the snapshot.
*/
public class CaptureCanvas extends Canvas implements CommandListener{
private Command captureCommand;
private GameMIDlet midlet;
/**
* Creates the CaptureCanvas. Adds a "Capture" command.
* @param midlet Facilitates call backs to the midlet.
*/
public CaptureCanvas(GameMIDlet midlet){
this.midlet = midlet;
captureCommand = new Command("Capture", Command.SCREEN, 1);
addCommand(captureCommand);
setCommandListener(this);
}
/**
* Paints a yellow background.
* @param g
*/
public void paint(Graphics g) {
g.setColor(0x00FFFF00); // yellow
g.fillRect(0, 0, getWidth(), getHeight());
}
/**
* Resonds to the "Capture" command and takes the photo.
* @param command
* @param displayable
*/
public void commandAction(Command command , Displayable displayable) {
if(command == captureCommand){
midlet.takePhoto();
}
}
/**
* Responds to the Joystick being pressed and takes the photo.
* @param keyCode Indicates the key that was pressed.
*/
public void keyPressed(int keyCode) {
int key = getGameAction(keyCode);
if (key == Canvas.FIRE) {
midlet.takePhoto();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -