?? videoplayer.java
字號:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/** A simple video player MIDlet using JSR 135 - Mobile Media API */
public class VideoPlayer extends MIDlet implements CommandListener
{
private Command exitCommand;
private Command playCommand;
private Command contentTypeCommand;
private Display display;
private TextField textField;
public Form form;
private Gauge gauge;
private static final int GAUGE_LEVELS = 4;
private static final int GAUGE_MAX = 12;
private static final String DEFAULT_URL = "file:///foot1/test.3gp";
public VideoPlayer() {
display = Display.getDisplay(this);
form = new Form("Video Player");
textField = new TextField("Video URL", DEFAULT_URL, 100, TextField.ANY);
gauge = new Gauge("Acquiring video", false, GAUGE_MAX, 0);
exitCommand = new Command("Exit", Command.EXIT, 2);
playCommand = new Command("Play", Command.SCREEN, 1);
contentTypeCommand = new Command("Supported media types", Command.SCREEN, 2);
form.addCommand(playCommand);
form.addCommand(exitCommand);
form.addCommand(contentTypeCommand);
form.setCommandListener(this);
form.append(textField);
}
public void startApp(){
display.setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
public void commandAction(Command c, Displayable s){
if(c == exitCommand){
destroyApp(false);
notifyDestroyed();
}
else if(c == playCommand){
gauge.setValue(0);
form.append(gauge);
VideoCanvas videoCanvas = new VideoCanvas(this);
videoCanvas.initializeVideo(textField.getString());
}
else if (c == contentTypeCommand){
String url = textField.getString();
int position = url.indexOf(':');
String protocol = url.substring(0, position);
SupportedTypes typesUI = new SupportedTypes(this, protocol);
display.setCurrent(typesUI);
}
}
public void updateGauge(){
int current = gauge.getValue();
current = (current + GAUGE_MAX/GAUGE_LEVELS);
gauge.setValue(current);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -