Skip to main content

Form

No replies
osama_xlt
Offline
Joined: 2012-02-13
Points: 0

Hello,

I am getting exception-java.lang.Error: Static initializer: java.lang.NullPointerException, 0
at java.lang.Class.throwError(), bci=57
at java.lang.Class.initialize(), bci=221
at com.sun.lwuit.Component.<init>(), bci=5
at com.sun.lwuit.Container.<init>(Container.java:66)
at com.sun.lwuit.Form.<init>(Form.java:158)
at com.sun.lwuit.Form.<init>(Form.java:676)
at comm.DisplayDict.<init>(DisplayDict.java:20)
at comm.commdict.StartDict.<init>(StartDict.java:15)
at java.lang.Class.newInstance(), bci=0
at com.sun.midp.main.CldcMIDletLoader.newInstance(), bci=46
at com.sun.midp.midlet.MIDletStateHandler.createMIDlet(), bci=66
at com.sun.midp.midlet.MIDletStateHandler.createAndRegisterMIDlet(), bci=17
at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=27
at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

in the following code.

package comm;

import comm.commdict.StartDict;
import com.sun.lwuit.*;
import com.sun.lwuit.events.*;

//This class is for user interface.

public class DisplayDict implements ActionListener
{
private Form frm;
private Command show, clear, history, help, about, exit;
private TextField tf;
private Display dp;
private StartDict sd;

public DisplayDict(StartDict sd)
{
this.sd=sd;
frm=new Form("COMM Dictionary");
tf=new TextField(30);
show=new Command("Show");
clear=new Command("Clear");
history=new Command("History");
help=new Command("Help");
about=new Command("About Dict");
exit=new Command("Exit");
frm.addComponent(tf);
frm.addCommand(show);
frm.addCommand(clear);
frm.addCommand(history);
frm.addCommand(help);
frm.addCommand(about);
frm.addCommand(exit);
frm.addCommandListener(this);
}

public void display()
{
frm.show();
}

public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==exit)
{
sd.destroyApp(false);
sd.notifyDestroyed();
}
}
}