如何在j2me中禁用导航键?

时间:2012-02-07 05:53:41

标签: java-me midp lcdui java-wireless-toolkit

我们正在为我们的j2me应用程序使用Sun Java Wireless Toolkit 2.5.2和lcdui软件包。我们想以编程方式禁用导航键(UP,DOWN,LEFT,RIGHT)。我该怎么办?

1 个答案:

答案 0 :(得分:5)

public void keyPressed(int keyCode) {
        int action = getGameAction(keyCode);
        if (action == UP || action == DOWN || action == LEFT || action == RIGHT)
        {}
        else
            super.keyPressed(keyCode);
}