import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ChoicesGroups extends MIDlet implements CommandListener { private Command vixod = new Command("Exit", Command.EXIT, 0); private Command nazad = new Command("Back", Command.BACK, 0); private Command vibor = new Command("Select", Command.SCREEN, 1); private Display ekran; private ChoiceGroup newForm; private Form myform; public ChoicesGroups() { Display.getDisplay(this); } private String[] arrays = {"Динамо Киев", "Шахтер Донецк", "гусей"}; public void startApp() { newForm = new ChoiceGroup("Команды", ChoiceGroup.POPUP, arrays, null); myform = new Form("Выберите команду"); myform.append(newForm); myform.addCommand(vixod); myform.addCommand(vibor); myform.setCommandListener(this); ekran.setCurrent(myform); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { if(c == vixod) { destroyApp(false); notifyDestroyed(); } if(c == nazad) { ekran.setCurrent(myform); } if(c == vibor) { int a = newForm.getSelectedIndex(); if(a == 0) { Form myclubs = new Form("Я фанат " + arrays[0]); myclubs.append(arrays[0]); myclubs.addCommand(vixod); myclubs.addCommand(nazad); myclubs.setCommandListener(this); ekran.setCurrent(myclubs); } if(a == 1) { Form myclubs = new Form("Я фанат " + arrays[1]); myclubs.append(arrays[1]); myclubs.addCommand(vixod); myclubs.addCommand(nazad); myclubs.setCommandListener(this); ekran.setCurrent(myclubs); } if(a == 2) { Form myclubs = new Form("Я фанат " + arrays[2]); myclubs.append(arrays[2]); myclubs.addCommand(vixod); myclubs.addCommand(nazad); myclubs.setCommandListener(this); ekran.setCurrent(myclubs); } } } }