張生工作室
一切皆有可能
BlogJava
::
首頁
::
新隨筆
::
聯系
::
聚合
::
管理
::
24 隨筆 :: 3 文章 :: 11 評論 :: 0 Trackbacks
<
2007年9月
>
日
一
二
三
四
五
六
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2008年12月 (3)
2008年11月 (9)
2008年7月 (1)
2008年5月 (1)
2007年9月 (10)
文章檔案
2011年3月 (1)
2008年11月 (1)
2007年12月 (1)
相冊
個人影集
好友鏈接
我的C#博管
我的百度博客
搜索
最新評論
1.?re: j2me模擬短信
我同意
--15170987588
2.?re: 求助(邊位仁兄有pointbase數據庫的,麻煩傳一份給我,急)
評論內容較長,點擊標題查看
--ufo
3.?re: MathLab使用
看不明白
--天涯浪子
4.?re: MathLab使用[未登錄]
請問要表示以(-0.5)為底的指數要怎么表示啊
--小小
5.?re: MathLab使用
快速入門,方便大家...謝謝..
--292939760
閱讀排行榜
1.?第四章 管理信息系統規劃與開發方法(6101)
2.?MathLab使用(2210)
3.?數學建模公車表(1696)
4.?數學建模公車表二(974)
5.?數學建模地鐵信息(949)
評論排行榜
1.?MathLab使用(3)
2.?數學建模公車表(3)
3.?數學建模地鐵信息(2)
4.?數學建模公車表二(1)
5.?求助(邊位仁兄有pointbase數據庫的,麻煩傳一份給我,急)(1)
今天是我開通java博客的第一天下,以后我慢慢貼上關于手機開發代碼,歡迎有這方面興趣的朋友大家一同討論
完成最簡單的鬧鈴功能
/**/
/*
* Midlet.java
*
* Created on 2007年9月8日, 下午12:24
*/
package
hello;
import
java.util.Date;
import
java.util.Timer;
import
java.util.TimerTask;
import
javax.microedition.midlet.
*
;
import
javax.microedition.lcdui.
*
;
/** */
/**
*
*
@author
Administrator
*
@version
*/
public
class
Midlet
extends
MIDlet
implements
javax.microedition.lcdui.CommandListener,javax.microedition.lcdui.ItemStateListener
{
private
Display display;
private
Form form;
private
DateField setAlarm;
Alert alert;
Command exitCmd;
Command cancelCmd;
Timer alarmTimer;
MyTimerTask alarmTask;
Date current;
boolean
firstTime
=
true
;
public
Midlet()
{
display
=
Display.getDisplay(
this
);
form
=
new
Form(
"
設定鬧鈴
"
);
alert
=
new
Alert(
""
);
alert.setTimeout(Alert.FOREVER);
form.append(
"
這是我第一次開發手機程序
"
);
alert.setString(
"
時間到了
"
);
setAlarm
=
new
DateField(
"
設定時間
"
,DateField.DATE_TIME);
exitCmd
=
new
Command(
"
退出
"
,Command.EXIT,
1
);
cancelCmd
=
new
Command(
"
關閉鈴聲
"
,Command.CANCEL,
1
);
current
=
new
Date();
alarmTimer
=
new
Timer();
alarmTask
=
new
MyTimerTask();
form.append(setAlarm);
form.setCommandListener(
this
);
form.addCommand(exitCmd);
form.addCommand(cancelCmd);
form.setItemStateListener(
this
);
alarmTimer
=
new
Timer();
alarmTask
=
new
MyTimerTask();
}
public
void
startApp()
{
display
=
Display.getDisplay(
this
);
display.setCurrent(form);
}
public
void
pauseApp()
{
}
public
void
destroyApp(
boolean
unconditional)
{
}
public
void
commandAction(Command command, Displayable displayable)
{
if
(command
==
exitCmd)
{
destroyApp(
false
);
notifyDestroyed();
}
else
if
(command
==
cancelCmd)
{
alarmTimer.cancel();
}
}
public
void
itemStateChanged(Item item)
{
Date setting
=
setAlarm.getDate();
if
(setting.getTime()
>
current.getTime())
{
alarmTimer.scheduleAtFixedRate(alarmTask,setting,
2000
);
}
}
class
MyTimerTask
extends
TimerTask
{
public
void
run()
{
if
(firstTime)
{
display.setCurrent(alert,form);
firstTime
=
false
;
}
AlertType.CONFIRMATION.playSound(display);
}
}
}
張生工作室
posted on 2007-09-08 21:27
張生工作室
閱讀(213)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © 張生工作室
主站蜘蛛池模板:
车致
|
安阳市
|
镇康县
|
维西
|
古浪县
|
南木林县
|
吉安县
|
馆陶县
|
襄城县
|
色达县
|
中江县
|
轮台县
|
花莲市
|
凤庆县
|
泸定县
|
黎川县
|
明溪县
|
昌图县
|
海城市
|
报价
|
加查县
|
滁州市
|
临漳县
|
修文县
|
营口市
|
文登市
|
三都
|
孙吴县
|
定安县
|
关岭
|
乾安县
|
信阳市
|
新竹县
|
满洲里市
|
许昌县
|
田林县
|
广州市
|
南雄市
|
弥勒县
|
贺州市
|
青州市
|