J2ME - 改变游戏中的视图

发布于 2024-11-18 12:01:53 字数 704 浏览 4 评论 0原文

我目前正在为纸牌游戏编写一个 J2ME 应用程序,该应用程序从一个菜单屏幕开始,该屏幕提供了选择要玩的许多不同纸牌游戏的选项。

这个菜单屏幕是一个表单,我需要知道如何导航到游戏的新表单。

public void commandAction(Command c, Displayable s) {

        if(c.equals(exitComm)){ 
                  }
                else if(c.equals(gameComm))
                {
                 //start the queen game...create instance of QueensForm
                  QueensForm form = new QueensForm(null, "Queens");
                  display.setCurrent(form);
                  System.out.println("pressed play");
                }

按照目前的情况,应用程序编译并运行,但是当单击播放按钮时,会发生错误,并显示问题出在 display.setCurrent(form); 行上,我不确定问题所在,并且是想知道是否有人可以帮助我解决这个问题或建议更好的方法来浏览应用程序中的表单。

I am currently writing a J2ME app for a card game which begins at a menu screen which gives the option to select a number of different card games to play.

This menu screen is a form and I need to know how to navigate to the new form for the games.

public void commandAction(Command c, Displayable s) {

        if(c.equals(exitComm)){ 
                  }
                else if(c.equals(gameComm))
                {
                 //start the queen game...create instance of QueensForm
                  QueensForm form = new QueensForm(null, "Queens");
                  display.setCurrent(form);
                  System.out.println("pressed play");
                }

As it stands the app compiles and runs, however when the play button is clicked an error occurs and it says the problem is on the line display.setCurrent(form); I am unsure of the problem and was wondering if anybody could help me to sort this out or suggest a better way to navigate throughout the forms in the app.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文