}
public void commandAction(Command cm, Displayable d) {
if (cm == List.SELECT_COMMAND || cm == cmEdit) {
// User selected an item in lsMain or
// invoked the "Edit" command from the menu
// Edit an item, we'll implement this later
} else if (cm == cmAdd) {
// User invoked the "Add" command from the menu
// Add a new item, we'll implement this later
} else if (cm == cmExit) {
// User invoked the "Exit" command
destroyApp(false);
notifyDestroyed();
}
}
public void pauseApp() {
}
public void destroyApp(boolean b) {
}
private void rebuildList(){
// add all the expense items to lsMain
for(int i=0; i<expenseItems.size(); i++){
if (expenseItems.elementAt(i) != null){
ExpenseInfo exp = (ExpenseInfo) expenseItems.elementAt(i);
lsMain.append(exp.getDescription(),null);
}
}
}
}
ExpenseInfo.java:
/*
ExpenseInfo
Models an expense item for the sample Expenses
J2ME MIDP application
Copyright 2002 CNet Networks
*/
package ExpensesApp;
import java.util.Date;
import java.util.Vector;
public class ExpenseInfo {
// Expense Item categories
public static final String[] Categories = {"Meals","Lodging","Car","Entertain","Misc"};
public static final int CATEGORY_MEALS = 0, CATEGORY_LODGING = 1,
CATEGORY_CAR = 2, CATEGORY_ENTER = 3, CATEGORY_MISC = 4;
// member variables
private Date ExpenseDate;
private String ExpenseDescription;
// We don't have floating point support,
// so we have to fake it with two int variables
// to store the amount of the expense
private int ExpenseDollars;
private int ExpenseCents;
private int ExpenseId;
private String ExpenseCategory;
private int ExpenseCategoryID;
public static Vector LoadExpenses() {
// Eventually, we'll need to load expenses from
// the data store into this vector, but for now
// let's just load some play data
Vector v = new Vector();
ExpenseInfo exp = new ExpenseInfo();
exp.setDescription("Car Rental");
exp.setDollars(25);
exp.setCents(99);
exp.setCategoryID(CATEGORY_CAR);
v.addElement(exp);
exp = new ExpenseInfo();
exp.setDescription("Hotel");
exp.setDollars(54);
exp.setCents(00);
exp.setCategoryID(ExpenseInfo.CATEGORY_LODGING);
v.addElement(exp);
exp = new ExpenseInfo();
exp.setDescription("Dinner");
exp.setDollars(18);
exp.setCents(78);
exp.setCategoryID(ExpenseInfo.CATEGORY_MEALS);
v.addElement(exp);
return v;
}
j2mePolish安装配置文档j2mePolish安装配置文档隐藏>> J2ME 移植 Polish 教程(1)之配置环境 2009-11-25 01:00 antenna 和 Polish 是常用的手机打包、移植的辅助工...
j2me教程 47页 1下载券 (J2ME入门一)Eclipse配置... 6页 免费在...在Eclipse下应用J2ME POLISH Author: 一滴蔚蓝色
j2me 中文教程_IT/计算机_专业资料。j2me 学习 开发 实例 应用 配置 中文教程1.01 修正版 版权声明本教程由J2ME开发网(www.j2medev.com)的网友集体创作。任何人...
中文教程(6) (6)— J2ME 中文教程(6)— GAME API 第6章 6.1 6.2 6.2.1 6.2.2 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6....
J2ME简介 ...1 1.2.1 概述......
j2me教程2_ch2(1) 5页 1下载券 VC绘图简易教程 42页 免费 VC绘图简易教程 36页 2下载券 VC绘图简易教程_4 4页 1下载券 VC绘图简易教程_3 2页 1下载券...
大学英语阅读教程(文化)... 18页 免费[Polish...J2ME?Polish 相关任务被分成的三部分 “info”, “deviceRequirements” 和“...
J2mePolish 集成 Eclipse 安装配置文档一, 环境 PC:windows Xp IDE:Eclipse3.2.1 IDE-plug-in:EclipseMe1.5.4 IDE-plug-in:Mepose0.7.1 JAVA :Jdk1.5...
J2ME开发教程_IT/计算机_专业资料。J2ME开发教程J2ME 开发环境达建 ...2 Eclipse 快速上手指南 ......
J2ME慢慢学教程_IT/计算机_专业资料。我们将从定义 J2ME 开始,然后讨论它的总体架构并学习 J2ME 目标设备。作为架构讨论的一部分,我们将提供有关简表和配置的概述...
热门文档