首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> J2ME >> 数据与存储 >> 正文
基于MIDP1.0实现RMS容量探测器
作者:mingjava    文章来源:j2medev.com    更新时间:2006-12-1 19:48:54
, 0, this);
        } catch (RecordStoreException e)
        {
            this.showAlertError(e.getMessage());
        }
        Form mainForm = new Form("RMS测试器");
        Image mainImage = getMainImage("java.png");
        if (mainImage != null)
        {
            mainForm.append(mainImage);
        } else
        {
            mainForm.append("欢迎使用自由软件");
        }
        mainForm.addCommand(startCommand);
        mainForm.addCommand(exitCommand);
        mainForm.setCommandListener(this);
        display.setCurrent(mainForm);

    }

    public Image getMainImage(String name)
    {
        Image image = null;
        try
        {
            image = Image.createImage("/" + name);
        } catch (IOException e)
        {
            return null;
        }
        return image;
    }

    public Display getDisplay()
    {
        return display;
    }

    protected void pauseApp()
    {
      

    }

    protected void destroyApp(boolean arg0) throws MIDletStateChangeException
    {
    

    }

    public void commandAction(Command cmd, Displayable disp)
    {
        if (cmd == startCommand)
        {
            display.setCurrent(counterCanvas);
            counterCanvas.start();
        } else if (cmd == exitCommand)
        {
            exitMIDlet();
        }
    }

    public void exitMIDlet()
    {
        try
        {
            destroyApp(false);
            notifyDestroyed();
        } catch (MIDletStateChangeException e)
        {
            showAlertError(e.getMessage());
        }
    }

    public void showAlertError(String message)
    {
        alert.setString(message);
        alert.setType(AlertType.ERROR);
        alert.setTimeout(2500);
        display.setCurrent(alert);

    }

}

import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.rms.*;

public class CounterCanvas extends Canvas implements CommandListener
{

    private RMSModel model;
    private RMSAnalyzer RMSanalyzer;
    private int interTime;
    private int counter;
    private boolean go = true;
    public static Command exitCommand

上一页  [1] [2] [3] [4] 下一页

相关文章:
Alert类的学习
用J2ME在移动设备上实现动画
一些实用的图形用户界面方法
我的第一个J2ME程序
J2ME手机文件加密
编写Palm J2ME红外线“聊天”程序
解决J2ME联网时出现的中文乱码问题
J2ME专业手机游戏开发基础(一)
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号