Модераторы: javastic, AntonSaburov
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> keyPressed(int code), Так и не смогу без вашей помощи 
:(
    Опции темы
Zamuta
Дата 22.8.2006, 01:45 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



Есть мидлет и есть канвас

Код


import javax.microedition.lcdui.*;

public class MenuScreen extends Canvas implements Runnable {

    static final Font lowFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL);
    static final Font highFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);

    static final int lowColor = 0x000000FF; 
    static final int highColor = 0x00FF0000; 
    static final int highBGColor = 0x00CCCCCC; 
    static int width; 
    static int height; 
    static int startHeight; 
    static final int spacing = highFont.getHeight()/2; 

    static final String[] mainMenu = {"New Game","High Score","Settings","Help","About"};

    static int menuIdx;

    Thread menuThread;

    public MenuScreen() {
   
        width = getWidth();
        height = getHeight();

        startHeight = (highFont.getHeight() * mainMenu.length) + ((mainMenu.length-1) *
                spacing);
        startHeight = (height - startHeight) / 2;

        menuIdx = 0;

        menuThread = new Thread(this);
        menuThread.start();
    }

    public void run() {
        while(true) {
            repaint();
        }
    }

    public void paint(Graphics g) {
        g.setColor(0x00FFFFFF);
        g.fillRect(0,0,width,height);
        for (int i=0; i<mainMenu.length; i++) {
            if (i==menuIdx) {
                g.setColor(highBGColor);
                g.fillRect(0,startHeight + (i*highFont.getHeight()) + spacing,width,highFont.getHeight());
                g.setFont(highFont);
                g.setColor(highColor);
                g.drawString(mainMenu[i], (width - highFont.stringWidth(mainMenu[i])) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing, 20);
            } else {
                g.setFont(lowFont);
                g.setColor(lowColor);
                g.drawString(mainMenu[i],
                        (width - lowFont.stringWidth(mainMenu[i]) ) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing,
                        20
                        );
            }
        }
    }

    protected void keyPressed(int code) {
        if (getGameAction(code) == Canvas.UP && menuIdx - 1 >= 0) {
            menuIdx--;                                                    // Поднимаем указатель вверх
        } else if (getGameAction(code) == Canvas.DOWN && menuIdx + 1 <
                mainMenu.length) {
            menuIdx++;                                                // Опускаем вниз
        }
        if () // --- дальше не знаю.................
    }
}



Как работать с keyPressed(int code) внутри этого же класса понятно, а как сделать переход к другому классу из под keyPressed не знаю. То есть, скажем, ещё отдельный класс , например, в котором экран закрашивался красным цветом. Думаю на CommandListener.  smile  Спасибо за ответы...


--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
Frog
Дата 22.8.2006, 03:55 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 32
Регистрация: 11.3.2006
Где: The swamp

Репутация: нет
Всего: нет



я не вполне понял суть проблемы - но к другому обьекту, из любого метода, включая keyPressed можно обратиться так :

Код

public void keyPressed(int code) {

myOtherClassInstance.doWhatIWant();

}


если-же Вы непременно хотите поменять Canvas ,то новый Сanvas будет иметь СВОЙ keyPressed(int code)  - в нем и прописывате нужный Вам код.

Это сообщение отредактировал(а) Frog - 22.8.2006, 03:58
PM MAIL WWW   Вверх
Zamuta
Дата 22.8.2006, 11:27 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



Ок. Объясню подробнее. Я хочу начать выполнение другого класса, как скажем, нажал на кнопку "Старт" и началось выполнение  класса рисующий графику, например так(самый простейший):

Код



import javax.microedition.lcdui.*;

public class Ris extends Canvas {
    
    /** Creates a new instance of Ris */
    public Ris() {
        }
    public void paint(Graphics g){
    int width = g.getClipWidth();
    int height = g.getClipHeight();
    g.setColor(100, 100, 100);
    g.fillRect(0, 0, width/2, height/2);
    }
    
}




То есть при выборе "New game" запускался один класс, при выборе  "Help" другой класс и так далее....


--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
javastic
Дата 22.8.2006, 11:46 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Комодератор
Сообщений: 1214
Регистрация: 18.3.2005
Где: St.Petersburg

Репутация: 19
Всего: 27



Код

SecondClass secondClass = new SecondClass();
display.setDisplay(secondClass);





--------------------
01101010 01100001 01110110 01100001 01110011 01110100 01101001 01100011
scjp, mcp 
PM MAIL WWW ICQ   Вверх
Zamuta
Дата 22.8.2006, 12:40 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



Ругается на строчку display.setDisplay(secondClass);
Привожу полный листинг  с изменениями:

Код


package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;

public class SimpleCustomMenu extends MIDlet implements CommandListener {
    Display display;
    Display pauseDisplay;
    boolean isSplash = true;
    MenuScreen menuScreen;
    Ris ris;
    public SimpleCustomMenu() {
        Ris ris = new Ris();
        display = Display.getDisplay(this);
        display.setCurrent(menuScreen);
    }
    protected void startApp() throws MIDletStateChangeException {
    }
    protected void pauseApp() { }
    protected void destroyApp(boolean flag) throws MIDletStateChangeException {}
    public void commandAction(Command cmd, Displayable dis) {
    }
}






Код


package hello;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class MenuScreen extends Canvas implements Runnable {
    private MIDlet SimpleCustomMenu;

    static final Font lowFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL);
    static final Font highFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);

    static final int lowColor = 0x000000FF; 
    static final int highColor = 0x00FF0000; 
    static final int highBGColor = 0x00CCCCCC; 
    static int width; 
    static int height; 
    static int startHeight; 
    static final int spacing = highFont.getHeight()/2; 

    static final String[] mainMenu = {"New Game","High Score","Settings","Help","About"};

    static int menuIdx;

    Thread menuThread;
    
    public MenuScreen(MIDlet SimpleCustomMenu) {
        this.SimpleCustomMenu = SimpleCustomMenu;
      
        width = getWidth();
        height = getHeight();

        startHeight = (highFont.getHeight() * mainMenu.length) + ((mainMenu.length-1) *
                spacing);
        startHeight = (height - startHeight) / 2;

        menuIdx = 0;

        menuThread = new Thread(this);
        menuThread.start();
    }

    public void run() {
        while(true) {
            repaint();
        }
    }

    public void paint(Graphics g) {
        g.setColor(0x00FFFFFF);
        g.fillRect(0,0,width,height);
        for (int i=0; i<mainMenu.length; i++) {
            if (i==menuIdx) {
                g.setColor(highBGColor);
                g.fillRect(0,startHeight + (i*highFont.getHeight()) + spacing,width,highFont.getHeight());
                g.setFont(highFont);
                g.setColor(highColor);
                g.drawString(mainMenu[i], (width - highFont.stringWidth(mainMenu[i])) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing, 20);
            } else {
                g.setFont(lowFont);
                g.setColor(lowColor);
                g.drawString(mainMenu[i],
                        (width - lowFont.stringWidth(mainMenu[i]) ) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing,
                        20
                        );
            }
        }
    }

    protected void keyPressed(int code) {
        if (getGameAction(code) == Canvas.UP && menuIdx - 1 >= 0) {
           menuIdx--;
        } else if (getGameAction(code) == Canvas.DOWN && menuIdx + 1 < mainMenu.length) {
            menuIdx++;
        }
        if (getGameAction(code) == Canvas.FIRE  ){
        Ris ris = new Ris();
            display.setDisplay(ris);  // <-- Это не нравится...
        }
    }
}



Код


package hello;

import javax.microedition.lcdui.*;

public class Ris extends Canvas {
    

    public Ris() {
        }
    public void paint(Graphics g){
    int width = g.getClipWidth();
    int height = g.getClipHeight();
    g.setColor(100, 100, 100);
    g.fillRect(0, 0, width/2, height/2);
    }
    
}



И ещё, как в моём случае получить ссылку на выбранный указатель, то есть если у меня меню состоит из  строкового массива String[] mainMenu = {"New Game","High Score","Settings","Help","About"};  Как в keyPressed ссылаться на отдельную строчку? И можно ли так вообще?
Какая константа отвечает за кнопку "Выбор" или "ОК" или нужен CommandListener
Спасибо..


Это сообщение отредактировал(а) Zamuta - 22.8.2006, 12:44


--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
javastic
Дата 22.8.2006, 14:10 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Комодератор
Сообщений: 1214
Регистрация: 18.3.2005
Где: St.Petersburg

Репутация: 19
Всего: 27



Ругается потому что ты подставляешь не Ris, а menuScreen который не создан. Подставь ещё 
Код

MenuScreen menuScreen = new MenuScreen();


до отображения или замени на Ris.

В методе keyPressed(int keyCode) первой строкой выполни следущее:
Код

int action = getGameAction(keyCode);
 ,а далее проверяй нажатия джойстика так:
Код


switch (action) {
                case UP:
                    Index--;
                    // тут проверка на переполнение твоего Index'a
                    break;

                case DOWN:
                    Index++;
                    // тут проверка на переполнение твоего Index'a
                    break;

                case FIRE:
                    Alert a = new Alert("Hello");
                    a.setString("Welcome! :), Selected index is: " + Index);
                    display.setCurrent(a, this);
            }


Заведи индекс для элекмента int Index = 0;
0 это будет NewGame
1 это будет High Score
и т.д.

Максимальное значение для индекса будет кол-во эл-тов в массиве.

Вот, всё расписал по полочкам.



--------------------
01101010 01100001 01110110 01100001 01110011 01110100 01101001 01100011
scjp, mcp 
PM MAIL WWW ICQ   Вверх
Zamuta
Дата 25.8.2006, 02:24 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



Да javastic, спасибо. С display.setCurrent() понятно, ничего необычного, но про переход в другой класс я так и не понял, как не пытался не получилось. В классе MenuScreen есть mainMenu.length , можно ли отсюда извлечь позицию курсора и выполнить переход, или получить номер строки массива mainMenu[i], при помощи public char charAt(int index){} , или использовать значение menuIdx ? Я затрудняюсь в том как это правильно сделать на языке java.  

Спасибо.



--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
javastic
Дата 25.8.2006, 12:15 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Комодератор
Сообщений: 1214
Регистрация: 18.3.2005
Где: St.Petersburg

Репутация: 19
Всего: 27



После того как ты нажал FIRE на джойстике вызывай следущее:
Код

// у тебя станет активный вторая канва, надо передать в конструктор ссылку 
//на первую канву, для того чтобы ты смог если надо вернуться назад к первой канве
display.setCurrent(new MenuScreen2(this)); 

// display можно передавать из класса в класс, а можно его в мидлете сделать статичным
// т.е. вызывать статичный метод который будет ссылаться на объект Display


charAt() тут ни к чему не нужен, используй индекс (см. выше я тебе всё расписал).
Чуть чуть поковыряешься и сделаешь, если проблемы с явой, то тут я тебе ни чем помочь не могу.


--------------------
01101010 01100001 01110110 01100001 01110011 01110100 01101001 01100011
scjp, mcp 
PM MAIL WWW ICQ   Вверх
Zamuta
Дата 26.8.2006, 00:24 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



1. Всё получилось. я использовал значение menuIdx. На эмуляторе(wtk) всё нормально выполняется при нажатии на кнопку select, а на моём телефоне (nokia 6060) только при нажатии на клавишу 5 или зелёной кнопки ответа, а на кнопку select не реагирует, посоветуйте что делать.... smile 

2. Попробовал сделать  message = getKeyName( code );    System.out.print(message);  пишет, что имя моей клавиши SELECT, но getGameAction(code) не хочет получать такой параметр. smile 

3. Запустил всё это на эмуляторе S40 Nokia 6255, включил монитор и увидел, что в разделе MIDP RAM объём используемой памяти постоянно растёт и когда доходит до максимума происходит сброс и процесс постоянно повторяется, не пойму почему...

Код



package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;

public class SimpleCustomMenu extends MIDlet implements CommandListener {
    protected Display display;
    boolean isSplash = true;
    private MenuScreen menuScreen;             
    private Ris ris;
    private HelpScreen helpScreen;
    public SimpleCustomMenu() {
        }
    protected void startApp() {
         display = Display.getDisplay(this);
         menuScreen = new MenuScreen(this);
         ris = new Ris(this);
         helpScreen = new HelpScreen(this);
         MenuScreenShow();
    }
    public Display getDisplay() {
        return display;
    }
    
    protected void pauseApp() { 
    }
    
    protected void destroyApp(boolean unconditional) {
        System.gc();
        notifyDestroyed();
    }
    
    public void MenuScreenShow(){
    display.setCurrent(menuScreen);
    }
    
    public void RisShow(){
    display.setCurrent(ris);
    }
    
    public void HelpShow(){
    display.setCurrent(helpScreen);
    }
    public void mainMenuScreenQuit() {
        destroyApp(true);
    }
    
    public void commandAction(Command c, Displayable d) {
    }
}





Код


package hello;

import javax.microedition.lcdui.*;


public class MenuScreen extends Canvas implements Runnable {
    private SimpleCustomMenu midlet;

    static final Font lowFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL);
    static final Font highFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);

    static final int lowColor = 0x000000FF; 
    static final int highColor = 0x00FF0000; 
    static final int highBGColor = 0x00CCCCCC; 
    static int width;
    static int height; 
    static int startHeight; 
    static final int spacing = highFont.getHeight()/2; 
    static final String[] mainMenu = {"New Game","Help","Settings","Hight Score","Quit"};

    static int menuIdx;

    Thread menuThread;
    private Display display;
    private Ris ris;
    private String message;
    public MenuScreen(SimpleCustomMenu midlet) {
        this.midlet = midlet;

        width = getWidth();
        height = getHeight();

        startHeight = (highFont.getHeight() * mainMenu.length) + ((mainMenu.length-1) *
                spacing);
        startHeight = (height - startHeight) / 2;

        menuIdx = 0;

        menuThread = new Thread(this);
        menuThread.start();
    }

    public void run() {
        while(true) {
            repaint();
        }
    }

    public void paint(Graphics g) {
        g.setColor(0x00FFFFFF);
        g.fillRect(0,0,width,height);
        for (int i=0; i<mainMenu.length; i++) {
            if (i==menuIdx) {
                g.setColor(highBGColor);
                g.fillRect(0,startHeight + (i*highFont.getHeight()) + spacing,width,highFont.getHeight());
                g.setFont(highFont);
                g.setColor(highColor);
                g.drawString(mainMenu[i], (width - highFont.stringWidth(mainMenu[i])) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing, 20);
            } else {
                g.setFont(lowFont);
                g.setColor(lowColor);
                g.drawString(mainMenu[i], (width - lowFont.stringWidth(mainMenu[i]) ) / 2,
                        startHeight + (i*highFont.getHeight()) + spacing, 20);
            }
        }
        repaint();
    }
  

    protected void keyPressed(int code) {
    //    int action = getGameAction(code);
        if (getGameAction(code) == Canvas.UP && menuIdx - 1 >= 0) {
            menuIdx--;
       } else if (getGameAction(code) == Canvas.DOWN && menuIdx + 1 < mainMenu.length) {
            menuIdx++;
       }
       if (getGameAction(code) == Canvas.FIRE && menuIdx == 0) {
              midlet.RisShow();
       }
        
       if (getGameAction(code) == Canvas.FIRE && menuIdx == 1) {
              midlet.HelpShow();
       }
       if (getGameAction(code) == Canvas.FIRE && menuIdx == 4) {
              midlet.mainMenuScreenQuit();
       }
       if (getGameAction(code) == Canvas.FIRE && menuIdx == 2) {
             message = getKeyName( code );  
             System.out.print(message);
       }        
        repaint();              
    }
}



Код


package hello;

import javax.microedition.lcdui.*;

public class HelpScreen extends Form implements CommandListener {
    private SimpleCustomMenu midlet;
    private Command backCommand = new Command("Back", Command.BACK, 1);
    public HelpScreen(SimpleCustomMenu midlet) {
        super("Help");
        this.midlet = midlet;
        StringItem stringItem = new StringItem(null, "Help, prosto help " );
        append(stringItem);
        addCommand(backCommand);
        setCommandListener(this);
    }
    public void commandAction(Command c, Displayable d) {
        if (c == backCommand) {
            midlet.MenuScreenShow();
            return;
        }
    }
}



Код


package hello;

import javax.microedition.lcdui.*;

public class Ris extends Canvas implements CommandListener {
    private SimpleCustomMenu midlet;
    private Command backCommand = new Command("Back", Command.BACK, 1);
   
    public Ris(SimpleCustomMenu midlet) {
        this.midlet = midlet;
        addCommand(backCommand);
        setCommandListener(this);
    }
    public void paint(Graphics g){
        int width = g.getClipWidth();
        int height = g.getClipHeight();
        g.setColor(235, 32, 100);
        g.fillRect(0, 0, width/2, height/2);
    }
    
     public void commandAction(Command c, Displayable d) {
        if (c == backCommand) {
            midlet.MenuScreenShow();
            return;
        }
    }
    
}




Это сообщение отредактировал(а) Zamuta - 26.8.2006, 02:13


--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
javastic
Дата 27.8.2006, 17:23 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Комодератор
Сообщений: 1214
Регистрация: 18.3.2005
Где: St.Petersburg

Репутация: 19
Всего: 27



Цитата

1. Всё получилось. я использовал значение menuIdx. На эмуляторе(wtk) всё нормально выполняется при нажатии на кнопку select, а на моём телефоне (nokia 6060) только при нажатии на клавишу 5 или зелёной кнопки ответа, а на кнопку select не реагирует, посоветуйте что делать....  


Посмотри что выводит Systemout.println(message), или просто считай keyCode.


--------------------
01101010 01100001 01110110 01100001 01110011 01110100 01101001 01100011
scjp, mcp 
PM MAIL WWW ICQ   Вверх
Zamuta
Дата 28.8.2006, 00:56 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 389
Регистрация: 18.1.2006

Репутация: нет
Всего: 6



Systemout.println(message),  выводит SELECT, но я не могу передать в getGameAction(code) SELECT потому что такого параметра просто не существует, и что делать дальше не знаю. А что на счёт переполнения памяти скажете? repaint(); я уже пробовал убирать, думал из-за него. 

Это сообщение отредактировал(а) Zamuta - 28.8.2006, 00:58


--------------------
Thank you opensource.
PM MAIL ICQ   Вверх
javastic
Дата 28.8.2006, 08:36 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Комодератор
Сообщений: 1214
Регистрация: 18.3.2005
Где: St.Petersburg

Репутация: 19
Всего: 27



Возможно раскладка клавиатуры какая-то нестандартная, вот все доступные поля:
Код

Field Summary 
static int DOWN 
          Constant for the DOWN game action. 
static int FIRE 
          Constant for the FIRE game action. 
static int GAME_A 
          Constant for the general purpose "A" game action. 
static int GAME_B 
          Constant for the general purpose "B" game action. 
static int GAME_C 
          Constant for the general purpose "C" game action. 
static int GAME_D 
          Constant for the general purpose "D" game action. 
static int KEY_NUM0 
          keyCode for ITU-T key 0. 
static int KEY_NUM1 
          keyCode for ITU-T key 1. 
static int KEY_NUM2 
          keyCode for ITU-T key 2. 
static int KEY_NUM3 
          keyCode for ITU-T key 3. 
static int KEY_NUM4 
          keyCode for ITU-T key 4. 
static int KEY_NUM5 
          keyCode for ITU-T key 5. 
static int KEY_NUM6 
          keyCode for ITU-T key 6. 
static int KEY_NUM7 
          keyCode for ITU-T key 7. 
static int KEY_NUM8 
          keyCode for ITU-T key 8. 
static int KEY_NUM9 
          keyCode for ITU-T key 9. 
static int KEY_POUND 
          keyCode for ITU-T key "pound" (#). 
static int KEY_STAR 
          keyCode for ITU-T key "star" (*). 
static int LEFT 
          Constant for the LEFT game action. 
static int RIGHT 
          Constant for the RIGHT game action. 
static int UP 
          Constant for the UP game action. 


Я заметил что у тебя в методе paint стоит в конце всего repaint() , не стоит этого делать!!!! 



--------------------
01101010 01100001 01110110 01100001 01110011 01110100 01101001 01100011
scjp, mcp 
PM MAIL WWW ICQ   Вверх
F1DEvELoP
Дата 25.3.2009, 09:39 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 20
Регистрация: 22.3.2009

Репутация: нет
Всего: нет



Нужна помощь
тут наворот по графике
а мне нужно просто опросить NUMPAD и выполнить по нажатой цифровой кнопке действие

запускаю потоком при старте мидлета
Код

//запускаем опрос клавиатуры в потоке!
        oposrKlavi opros = new oposrKlavi(this);
        opros.start();


далее класс потока опроса клавы
Код

//опрос клавиатуры
class oposrKlavi implements Runnable  {

  private HelloMIDlet MIDlet;
  public oposrKlavi (HelloMIDlet MIDlet)
  {
   this.MIDlet = MIDlet;
  }
  public void run()
  {
    try
    {
       OprosAct ();
    }
    catch (Exception error)
    {
      //System.err.println(error.toString());
      myform.append(new StringItem("Exception IOException: ", ""+ error.toString()));

    }
  }

  public void start()
  {
    Thread thread = new Thread(this);
    try
    {
      thread.start();
    }
    catch (Exception error)
    {
        myform.append(new StringItem("thread IOException: ", ""+ error.toString()));
    }
  }
  private void OprosAct() throws IOException
  {

      //каким способ опрашивать numpad ???

   }
}


//END опрос клавиатуры
PM MAIL ICQ   Вверх
  
Ответ в темуСоздание новой темы Создание опроса

  • Прежде чем задать вопрос прочтите это!
  • Литература по Java находится здесь.
  • Литературу по Java обсуждаем здесь.
  • Используйте теги [code=java][/code] для подсветки кода. Используйтe чекбокс "транслит" (возле кнопок кодов) если у Вас нет русских шрифтов.
  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда

  • FAQ раздела лежит здесь!
 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Java ME (J2ME) | Следующая тема »


 




[ Время генерации скрипта: 0.0609 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.