import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.util.*; import java.io.IOException; public class SlideShow extends MIDlet implements Runnable { public Thread thread; public Canv canv; public Display display; public Image image; public Image up, down; public int number, k, bar; public int [][][][][][][][] arr; private Graphics g; public String[] str; public SlideShow() { canv=new Canv(this); } public void startApp() { try { up=Image.createImage("/up.png"); down=Image.createImage("/down.png"); } catch(IOException ioe){} thread=new Thread(); image=Image.createImage(canv.getWidth(), canv.getHeight()); g=image.getGraphics(); str=new String[5]; bar=5; int day=Calendar.getInstance().get(Calendar.DAY_OF_WEEK); if (day==2){ ponedelnik(); number=1;} if (day==3){vtornik(); number=2;} if (day==4) {sreda(); number=3;} if (day==5){ chetverg(); number=4;} if (day==6){ patnitsa(); number=5;} display = Display.getDisplay(this); display.setCurrent(canv); thread.start(); } public void pauseApp() { } public void destroyApp(boolean unconditional) { notifyDestroyed(); } public void command() { if (number<=5) { number++; if (number>5) number = 1; } if(number==1) ponedelnik(); if(number==2) vtornik(); if(number==3) sreda(); if(number==4) chetverg(); if(number==5) patnitsa(); } public void setImage(String[] s) { g.setColor(0,0,0); g.fillRect(0, 0, image.getWidth(), image.getHeight()); for (int i=0;i<=canv.getWidth();i++){ g.drawImage(up, i, 0, Graphics.LEFT | Graphics.TOP); g.drawImage(down, i, canv.getHeight()-60, Graphics.LEFT | Graphics.TOP); } g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE)); g.setColor(0,0,255); g.drawString(s[0], image.getWidth()/2-g.getFont().stringWidth(s[0])/2, 3, Graphics.LEFT | Graphics.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_MEDIUM)); k=canv.getHeight()/2-(g.getFont().getHeight()*6)/2; g.setColor(255, 255, 0); g.drawString(s[1],bar,k, Graphics.LEFT | Graphics.TOP); g.drawString(s[2],bar,k+g.getFont().getHeight()*2, Graphics.LEFT | Graphics.TOP); g.drawString(s[3],bar,k+g.getFont().getHeight()*4, Graphics.LEFT | Graphics.TOP); g.drawString(s[4],bar,k+g.getFont().getHeight()*6, Graphics.LEFT | Graphics.TOP); g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM)); g.setColor(255,255,255); g.drawString("Функции", 3, canv.getHeight()- (g.getFont().getHeight()+3), Graphics.LEFT | Graphics.TOP); g.drawString("Далее", canv.getWidth()-(g.getFont().stringWidth("Далее")+3), canv.getHeight()- (g.getFont().getHeight()+3), Graphics.LEFT | Graphics.TOP); canv.repaint(); } public void ponedelnik() { str[0]="Понедельник"; str[1]="Информатика(55)"; str[2]="Англ. язык(52)"; str[3]="Электротехн(301)"; str[4]="Электротехн(2 нед)(301)"; } public void vtornik() { str[0]="Вторник"; str[1]="Черчение(1 гр.)(62)"; str[2]="Укр. язык(42)"; str[3]="Электротехн(301)"; str[4]="Математика(72)"; } public void sreda() { str[0]="Среда"; str[1]="История Украины(81)"; str[2]="Физ-ра"; str[3]="Биология(74)"; str[4]="Черчение(2 гр)(62)"; } public void chetverg() { str[0]="Четверг"; str[1]="Экономика(210)"; str[2]="Физика(73)"; str[3]="Культурология(80)"; str[4]="Специализация(2 нед)(301)"; } public void patnitsa() { str[0]="Пятница"; str[1]="Горное дело(316)"; str[2]="Электротехн(301)"; str[3]=" "; str[4]=" "; } public void run() { while(true) setImage(str); } }