代号一回到上一个表格命令错误

时间:2018-12-19 13:04:42

标签: java codenameone back

我想访问应用程序的本机硬件后退按钮以转到以前的表格。听起来很琐碎,但使用此处找到的方法时,我遇到了一系列问题:

Command back = new Command("Back") {
     public void actionPerformed(ActionEvent ev) {

       showPreviousForm();
    }
};

The method showBack() is undefined for the type new Command(){}

对于这两种方法,我都会收到一条错误消息:

The method PreviousForm() is undefined for the type new Command(){}

   <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.ApplicationLaunch</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>

方法有变化吗?有没有不同的方法?

预先感谢您的任何答复。

1 个答案:

答案 0 :(得分:1)

showBackForm的一种方法,因此,如果命令在Form子类中定义,则此方法将起作用。否则,您将需要表单的实例来对此进行调用。

showPreviousForm是您需要定义的自定义方法,以某种方式显示以前的形式。

相关问题