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

📄 20fb9e1d249a001b1a15912de8b02075

📁 《J2ME实用教程》 源文件下载 本书没有仅仅局限于J2ME单机游戏的开发
💻
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
public class PlaySimpleTone extends MIDlet implements CommandListener {
	private Player mp;
	private Display display;
	private List list;
	private Command exitCommand = new Command("Exit", Command.EXIT, 2);
	private Command playCommand = new Command("Play", Command.ITEM, 1);
	public PlaySimpleTone() {
		display = Display.getDisplay(this);
		list = new List("音调例子", List.IMPLICIT);
	}
	public void startApp() {
		list.addCommand(exitCommand);
		list.addCommand(playCommand);
		list.setCommandListener(this);
		display.setCurrent(list);
	}
	public void commandAction(Command c, Displayable s) {
		if (c == exitCommand) {
			destroyApp(false);
			notifyDestroyed();
		}
		if (c == playCommand) {
			simpleTone();
		}
	}
	private void simpleTone() {
		try {
			Manager.playTone(ToneControl.C4, 100, 80);
		} catch (Exception ex) {
		}
	}
}

⌨️ 快捷键说明

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