/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import javax.microedition.lcdui.*; /** * @author Ramirass */ public class rukzak extends Canvas { Menu menu; Image img99; public static String[] RukY = new String[5]; public static int[] RukYv = new int[5]; public static String[] RukK = new String[5]; public static String[] RukL = new String[5]; public static int[] RukLv = new int[5]; public static String[] RukKr = new String[5]; public static int[] RukKrk = new int[5]; public static String[] RukN = new String[10]; public static int[] RukNk = new int[10]; int j,i; public rukzak(Menu menu) { setFullScreenMode(true); this.menu=menu; try{ img99=Image.createImage("/baza/mag.png"); } catch ( Exception exc ){} } protected void paint(Graphics g) { g.setFont(Font.getFont(Font.STYLE_BOLD)); g.drawImage(img99,0,0,20); g.drawString(+magazin.money+" руб", 10, 10, 0); if(yct==true&&j==0&&udochka==RukYv[i])g.drawString("установленно", getWidth()/2, 278, g.TOP|g.HCENTER); if(no==true)g.drawString("купите снасть", getWidth()/2, 278, g.TOP|g.HCENTER); if(yctK==true&&j==1&&katyxa==RukK[i])g.drawString("установленно", getWidth()/2, 278, g.TOP|g.HCENTER); if(noK==true)g.drawString("купите снасть", getWidth()/2, 278, g.TOP|g.HCENTER); if(yctL==true&&j==2&&leska==RukLv[i])g.drawString("установленно", getWidth()/2, 278, g.TOP|g.HCENTER); if(noL==true)g.drawString("купите снасть", getWidth()/2, 278, g.TOP|g.HCENTER); if(yctKr==true&&j==3&&kruk==RukKrk[i])g.drawString("установленно", getWidth()/2, 278, g.TOP|g.HCENTER); if(noKr==true)g.drawString("купите снасть", getWidth()/2, 278, g.TOP|g.HCENTER); if(yctN==true&&j==4&&naz==RukNk[i])g.drawString("установленно", getWidth()/2, 278, g.TOP|g.HCENTER); if(noN==true)g.drawString("купите снасть", getWidth()/2, 278, g.TOP|g.HCENTER); if(j==0){g.drawString(magazin.Info[0], getWidth()/2, 70, g.TOP|g.HCENTER); g.drawString(RukY[i], 40, 130, 0); g.drawString("вес: "+RukYv[i]+" кг", 40, 170, 0);} if(j==1){g.drawString(magazin.Info[1], getWidth()/2, 70, g.TOP|g.HCENTER); g.drawString(RukK[i], 40, 130, 0);} if(j==2){g.drawString(magazin.Info[2], getWidth()/2, 70, g.TOP|g.HCENTER); g.drawString(RukL[i], 40, 130, 0); g.drawString("до: "+RukLv[i]+" кг", 40, 170, 0);} if(j==3){g.drawString(magazin.Info[3], getWidth()/2, 70, g.TOP|g.HCENTER); g.drawString(RukKr[i], 40, 130, 0); g.drawString("количество: "+RukKrk[i]+" шт", 40, 170, 0);} if(j==4){g.drawString(magazin.Info[4], getWidth()/2, 70, g.TOP|g.HCENTER); g.drawString(RukN[i], 40, 130, 0); g.drawString("количество: "+RukNk[i]+" шт", 40, 170, 0);} } public static int udochka; public static String udochkas; boolean yct=false; boolean no=false; public void getY() { if(magazin.l>=0&&magazin.l<=4) {yct=true; udochkas = RukY[i]; udochka = RukYv[i];} else {no=true;} } public static String katyxa; boolean yctK=false; boolean noK=false; public void getK() { if(magazin.h>=0&&magazin.h<=4) {yctK=true; katyxa = RukK[i];} else {noK=true;} } public static int leska; public static String leskas; boolean yctL=false; boolean noL=false; public void getL() { if(magazin.y>=0&&magazin.y<=4) {yctL=true; leskas = RukL[i]; leska = RukLv[i];} else {noL=true;} } public static int kruk; public static String kruks; boolean yctKr=false; boolean noKr=false; public void getKr() { if(magazin.p>=0&&magazin.p<=4) {yctKr=true; kruks = RukKr[i]; kruk = RukKrk[i];} else {noKr=true;} } public static int naz; public static String nazs; boolean yctN=false; boolean noN=false; public void getN() { if(magazin.r>=0&&magazin.r<=4) {yctN=true; nazs = RukN[i]; naz = RukNk[i];} else {noN=true;} } protected void keyPressed(int key) { if(key==52) {j--; i=0; no=false; noK=false; noL=false; noKr=false; noN=false; } if(key==54) {j++; i=0; no=false; noK=false; noL=false; noKr=false; noN=false; } if(key==50) {i--; no=false; noK=false; noL=false; noKr=false; noN=false; } if(key==56) {i++; no=false; noK=false; noL=false; noKr=false; noN=false; } if(j<0)j=0; if(j>4)j=4; if(i<0)i=0; if(j==0&&i>magazin.l)i=magazin.l; if(j==1&&i>magazin.h)i=magazin.h; if(j==2&&i>magazin.y)i=magazin.y; if(j==3&&i>magazin.p)i=magazin.p; if(j==4&&i>magazin.r)i=magazin.r; if(j==0&&key==53) { getY(); } if(j==1&&key==53) { getK(); } if(j==2&&key==53) { getL(); } if(j==3&&key==53) { getKr(); } if(j==4&&key==53) { getN(); } if(key==57) { i=0; j=0; no=false; noK=false; noL=false; noKr=false; noN=false; menu.gmenu(); } repaint(); } }