import java.io.*; import javax.microedition.lcdui.game.*; import javax.microedition.lcdui.*; import javax.microedition.media.*; public class Zastawka extends GameCanvas implements Runnable { private Player player; private Image image1,image2,image3,image4; private Thread thread; public Zastawka(){ super(true); try{ InputStream is=getClass().getResourceAsStream("/zastawka.amr"); player=Manager.createPlayer(is,"audio/mpeg"); player.prefetch(); image1=Image.createImage("/zastawka1.png"); image2=Image.createImage("/zastawka2.png"); image3=Image.createImage("/zastawka3.png"); image4=Image.createImage("/zastawka4.png"); thread=new Thread(this); }catch(Exception e){} } public void play(Display display){ display.setCurrent(this); thread.start(); } public void run(){ try{ player.start(); cls(); getGraphics().drawImage(image1, 0, 0, 20); flushGraphics(); thread.sleep(6000); cls(); getGraphics().drawImage(image2, 0, 0, 20); flushGraphics(); thread.sleep(6000); cls(); getGraphics().drawImage(image3, 0, 0, 20); flushGraphics(); thread.sleep(6000); cls(); getGraphics().drawImage(image4, 0, 0, 20); flushGraphics(); thread.sleep(6000); player.close(); }catch(Exception e){} } private void cls(){ getGraphics().setColor(255,255,255); getGraphics().fillRect(0,0,getWidth(),getHeight()); } }