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

📄 displayable1.java

📁 一个播放音乐的J2ME程序,已调试成功,在Eclipse环境下编写,由J2ME模拟器仿真成功
💻 JAVA
字号:
//import javax.microedition.midlet.MIDlet;
//import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDletStateChangeException;

public  class Displayable1 extends Canvas implements CommandListener {
	playmusic p = new playmusic("/wozhuanqianle.midi");
	private Command exitCommand;
	public Displayable1() {
		exitCommand=new Command("Exit", Command.EXIT, 1);
		try {
		      jbInit();
		    }
		catch(Exception e) {
		      e.printStackTrace();
		    }		
	}

	private void jbInit() throws Exception {
	    // Set up this Displayable to listen to command events
	    setCommandListener(this);
	    // add the Exit command
	    addCommand(exitCommand);

	}

	public void commandAction(Command command, Displayable displayable) {
	    if (command == exitCommand) {
	// stop the MIDlet
	      try {
			MEvidio.quitApp();
		} catch (MIDletStateChangeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	    }
	  }

	public void paint(Graphics g) {
	   
	    p.play(100,true);

	  }

	/*public void setExitCommand(Command exitCommand) {
		this.exitCommand = exitCommand;
	}

	public Command getExitCommand() {
		return exitCommand;
	}*/

}

⌨️ 快捷键说明

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