开发者

JVM exception in simple program

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.ale开发者_如何学编程rt("Goodbye!");
        System.exit(0);
        return true;
    }
}


create a new workspace. It's related to Eclipse, not to your code

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜