import java.io.IOException; import javax.microedition.lcdui.*; import javax.microedition.media.*; public class canv extends Canvas { public int w,h; public Image img; public Player plr; public canv() { w = getWidth(); h = getHeight(); try { img = Image.createImage("/logo.png"); plr = Manager.createPlayer(getClass().getResourceAsStream("/m.mid"), "audio/midi"); plr.realize(); plr.pretetch(); plr.setLoopCount(2); } catch (IOException ex) { ex.printStackTrace(); } } public void paint(Graphics g) { g.setColor(0x000000); g.fillRect(0,0,w,h); g.drawImage(img, w/2, h/2, Graphics.HCENTER | Graphics.VCENTER); g.setColor(0,255,0); g.drawString("0 - Выход",0,h/2,20); repaint(); } public void keyPressed(int keyCode) { if (keyCode==48) main.midlet.destroyApp(true); // выходим if (keyCode==-26){ try{ plr.start(); } catch(MediaException mex){ mex.printStackTrace(); } } } public void keyRepeated(int keyCode) { } }