简单程序中的 JVM 异常

发布于 2024-09-16 09:05:47 字数 1765 浏览 4 评论 0原文

我正在编写一个小演示程序来显示一个消息框以在黑莓中运行。一旦我单击对话框中的“确定”按钮,它就会向我抛出 JVM 错误 104,未捕获:运行时异常。有什么帮助吗?这是代码:

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;
    }
}

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;
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烧了回忆取暖 2024-09-23 09:05:47

创建一个新的工作区。它与 Eclipse 有关,与您的代码无关

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文