/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * To change this template, choose Tools | Templates * and open the template in the editor. * * toDo подумать о реализации меню!!!! */ import javax.microedition.lcdui.*; /** * @author Администратор */ public class Graph extends Canvas { protected int width, height; protected String listM[] = {"Войти", "Выход"}; protected int key = 0; protected Image I; private Graphics G; public Graph() { setFullScreenMode(true); width = getWidth(); height = getHeight(); I = Image.createImage(width, height); G = I.getGraphics(); } public void paint(Graphics g) { listG(G); g.drawImage(I, width / 2, height / 2, 3); } public void listG(Graphics g) { g.setColor(0xffffff); g.fillRect(0, 0, width, height); Font font = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL); g.setFont(font); g.setColor(0x000000); for (int i = 0; i < listM.length; i++) { g.drawString(listM[i], 10, 10 + (i * 15), 20); } g.drawRect(10, 10 + (key * 15), listM[key].length() * 8, 15); } public void keyPressed(int keyCode) { if (keyCode == 56) { if (listM.length - 1 == key) { key = 0; } else { key++; } } if (keyCode == 53) { if(key==0) { key=0; } else if(key==1){ } } repaint(); } }