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

📄 videoform.java

📁 《开发Nokia S40应用程序》源码(8-10章) 《开发Nokia S40应用程序》源码(8-10章)
💻 JAVA
字号:
package com.Series40Book;

import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.VideoControl;
import javax.microedition.media.control.GUIControl;

public class VideoForm extends Form
         implements CommandListener {

  private Player player;
  private Command done;

  public VideoForm () {
    super ("Play video");
    done = new Command("Done", Command.OK, 1);
    addCommand (done);
    setCommandListener (this);
  }

  public void startPlayer (Player p) {
    player = p;
    try {
      // Add the video playback window (item)
      VideoControl video =
        (VideoControl) player.getControl("VideoControl");
      Item item = (Item) video.initDisplayMode(
          GUIControl.USE_GUI_PRIMITIVE, null);
      item.setLayout(Item.LAYOUT_CENTER |
                     Item.LAYOUT_NEWLINE_AFTER);
      append(item);
      // Add a caption
      StringItem s = new StringItem ("", "Video");
      s.setLayout(Item.LAYOUT_CENTER);
      append (s);

      player.start();

    } catch (Exception e) {
      e.printStackTrace();
      append ("An error has occurred");
    }
  }

  public void commandAction(Command c, Displayable s) {
    if (c == done) {
      MediaPlayer.stopPlayer ();
      MediaPlayer.showMenu ();
    }
  }
}

⌨️ 快捷键说明

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