import javax.microedition.lcdui.*; import javax.microedition.media.*; /** * @author aNNiMON */ public class Second extends Canvas { public int w,h; public Player []plr; int music,music1,music2; public Second() { setFullScreenMode(true); w = getWidth(); h = getHeight(); plr=new Player[4]; for (int i=0;i<4;i++) { try { music=i; plr[music] = Manager.createPlayer(getClass().getResourceAsStream("/m"+i+".mid"), "audio/midi"); plr[music].realize(); plr[music].prefetch(); } catch (Exception ex) { ex.printStackTrace(); } } music1=3; music2=0; } public void paint(Graphics g) { setFullScreenMode(true); try { plr[music1].setLoopCount(-1); plr[music1].start(); } catch (Exception ex) { ex.printStackTrace(); } g.setColor(0xffffff); g.fillRect(0,0,w,h); g.setColor(0,255,0); g.drawString("0-",0,h/2,20); repaint(); } public void keyPressed(int keyCode) { if (keyCode==53) { try { plr[music2].setLoopCount(1); plr[music2].start(); } catch (Exception ex) { ex.printStackTrace(); } } if (keyCode==54) { music2++; } if (music2>=4) { music2=0; } } public void keyRepeated(int keyCode) { } }