Java Reference
In-Depth Information
}
public void pauseApp() {
}
public void destroyApp (boolean unconditional) {
}
public void commandAction (Command c, Displayable d) {
if (c == exitCommand) {
notifyDestroyed();
}
else if (c == setCommand) {
display.setCurrent (valueForm);
}
else if (c == dateCommand) {
display.setCurrent (dateForm);
}
else {
try {
if (c == okCommand && d == valueForm) {
dayLog.set (valueForm.getTime(),
Integer.parseInt
(valueForm.getValue()));
log.storeDayLog (dayLog);
display.setCurrent (chart);
chart.repaint();
}
else if (c == okCommand && d == dateForm) {
dayLog = log.getDayLog (LogStorage.dateToInt
(dateForm.getDate()));
display.setCurrent (chart);
}
else if (c == removeCommand) {
dayLog.remove (valueForm.getTime());
log.storeDayLog (dayLog);
}
}
catch (Exception e) {
Alert inputError = new Alert ("Invalid Value:");
inputError.setString (e.toString());
display.setCurrent (inputError);
}
}
}
}
Listing 9.2 BloodSugarPdap.java —The BloodSugarPdap Application
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.microedition.midlet.*;
import javax.microedition.rms.*;
public class BloodSugarPdap extends MIDlet implements ActionListener
{
 
Search WWH ::




Custom Search