J2ME中文教程 3 MIDP高级UI 的使用[16]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

        implements CommandListener {

 

        AlertType[] alertTypes = {

            AlertType.ALARM, AlertType.CONFIRMATION, AlertType.ERROR,

            AlertType.INFO, AlertType.WARNING

        };

        ChoiceGroup typesCG;

        int[] timeouts = { 2 * SECOND, 4 * SECOND, 8 * SECOND, Alert.FOREVER };

        ChoiceGroup timeoutsCG;

        ChoiceGroup indicatorCG;

 

        public AlerListener(ChoiceGroup types, ChoiceGroup timeouts,

                            ChoiceGroup indicator) {

            typesCG = types;

            timeoutsCG = timeouts;

            indicatorCG = indicator;

        }

 

        public void commandAction(Command c, Displayable d) {

 

            if (c == CMD_SHOW) {

 

                int typeIndex = typesCG.getSelectedIndex();

                Alert alert = new Alert("Alert");

                alert.setType(alertTypes[typeIndex]);

 

                int timeoutIndex = timeoutsCG.getSelectedIndex();

                alert.setTimeout(timeouts[timeoutIndex]);

本文关键:J2ME中文教程 3 MIDP高级UI 的使用
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top