Java Reference
In-Depth Information
The user interfaces for MIDP and PDAP are shown in Listings 9.1 and 9.2 . In addition, Figure 9.3
shows a BloodSugarPDAP screenshot.
Figure 9.3. The running BloodSugarPdap application showing the logged blood sugar
values of the current day.
Listing 9.1 BloodSugarMidp.java —The BloodSugarMidp MIDlet
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
import java.util.*;
import java.io.*;
public class BloodSugarMidp extends MIDlet implements CommandListener
{
LogStorage log;
DayLog dayLog;
Display display;
Chart chart;
ValueForm valueForm;
DateForm dateForm;
class Chart extends Canvas {
public void paint (Graphics g) {
g.setColor (0x00FFFFFF);
g.fillRect (0, 0, getWidth(), getHeight());
g.setColor (0x00000000);
int charWidth = g.getFont().charWidth ('0');
int xSpace = 3*charWidth;
int ySpace = g.getFont().getHeight();
int h = getHeight() - 2*ySpace;
int w = getWidth() - xSpace;
String title = dayLog.getTitle();
int tw = g.getFont().stringWidth (title);
 
 
Search WWH ::




Custom Search