views:

58

answers:

0

Hi, I am writing a small demo program to display a message box in to run in blackberry. As soon as I click the OK button on the dialog, it throws me a JVM Error 104, uncaught:runtimeexception. Any help please? Here is the code :

import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
public class My_First_App extends UiApplication
{
    public static void main(String[] args)
    {
        My_First_App theApp = new My_First_App();
        theApp.enterEventDispatcher();
    }
    public My_First_App()
    {
        pushScreen(new My_First_AppScreen());
    }
}

final class My_First_AppScreen extends MainScreen
{
    public My_First_AppScreen()
    {
        super();
        HorizontalFieldManager _fieldmanager;
        _fieldmanager = new HorizontalFieldManager();
        /* declare one label to how the application title */

        LabelField applicationtitle = new LabelField("Demo",LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);

        ButtonField _pairMe = new ButtonField("PairMe");

        FieldChangeListener listenerPairMe = new FieldChangeListener() {
            public void fieldChanged(Field field, int context){
                Dialog.alert("You clicked the button!");

            }
            };


        /*set the title*/
            add(_fieldmanager);
            setTitle(applicationtitle);

        _fieldmanager.add(_pairMe);
        _pairMe.setChangeListener(listenerPairMe);



    }
    public boolean onClose()
    {
        Dialog.alert("Goodbye!");
        System.exit(0);
        return true;
    }
}