没有访问权限
帮朋友问个问题,以下三个类,编译跑起来显示没有访问权限,是因为哪的问题呢?
1、BiorhythmCanvas.java
import java.io.*;
import java.util.Date;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
public final class BiorhythmMIDlet extends MIDlet
implements CommandListener //,ItemStateListener
{
public BiorhythmMIDlet()
{
super();
canvas = new BiorhythmCanvas();
canvas.addCommand(exitCmd);
canvas.addCommand(showBirthCmd);
canvas.setCommandListener(this);
form = new BiorhythmForm("生日");
form.addCommand(birthOKCmd);
form.addCommand(birthCancelCmd);
form.setCommandListener(this);
}
public void startApp()
{
readDate();
if( date == null)
{
Display.getDisplay(this).setCurrent(form);
}
else
{
canvas.setBirthday(date);
Display.getDisplay(this).setCurrent(canvas);
}
}
public void pauseApp()
{
}
public void destroyApp(boolean flag)
{
}
public void commandAction(Command c,Displayable d)
{
if (c== exitCmd)
{
notifyDestroyed();
}
else if ( c == showBirthCmd )
{
form.setDate(date);
Display.getDisplay(this).setCurrent(form);
}
else if ( c== birthOKCmd)
{
date = form.getDate();
if (date == null) return;
canvas.setBirthday(date);
saveDate();
Display.getDisplay(this).setCurrent(canvas);
}
else if (c == birthCancelCmd)
{
Display.getDisplay(this).setCurrent(canvas);
}
}
private void saveDate()
{
byte abyte0[];
if (date == null)
return;
abyte0 = null;
try
{
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
dataoutputstream.writeLong(date.getTime());
abyte0 = bytearrayoutputstream.toByteArray();
dataoutputstream.close();
}
catch (IOException ioexception)
{
System.err.println(ioexception);
}
if (abyte0 == null)
return;
try{
RecordStore recordstore = RecordStore.openRecordStore("Biorhythm",true);
if (recordstore == null)
return;
int cnt = recordstore.getNumRecords();
if ( cnt == 0)
{
recordstore.addRecord(abyte0,0,abyte0.length);
}
else
{
recordstore.setRecord(1,abyte0,0,abyte0.length);
}
recordstore.closeRecordStore();
} catch (RecordStoreException recordstoreexception)
{
System.err.println(recordstoreexception);
}
}
private void readDate()
{
byte abyte0[] = null;
try
{
RecordStore recordstore = RecordStore.openRecordStore("Biorhythm",false);
if (recordstore.getNumRecords() !=0)
abyte0 = recordstore.getRecord(1);
recordstore.closeRecordStore();
}
catch (RecordStoreException recordstoreexception)
{
System.err.println(recordstoreexception);
}
if (abyte0 !=null)
try
{
DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(abyte0));
date = new Date (datainputstream.readLong());
datainputstream.close();
}
catch(IOException ioexception)
{
System.err.println(ioexception);
}
}
private Date date;
private BiorhythmCanvas canvas;
private BiorhythmForm form;
private Command exitCmd = new Command("Exit",Command.EXIT,1);
private Command showBirthCmd = new Command("Birth",Command.SCREEN,2);
private Command birthOKCmd = new Command("OK",Command.EXIT,1);
private Command birthCancelCmd = new Command("Cancel",Command.SCREEN,1);
}