java - 代号一返回上一表单命令错误
问题描述
我想访问我的应用程序的本机硬件后退按钮以转到以前的表单。听起来微不足道,但是当使用此处找到的方法时,我遇到了一系列问题:
Command back = new Command("Back") {
public void actionPerformed(ActionEvent ev) {
showBack();
}
};
或者
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(){}
方法有没有变化?有不同的方法吗?
提前感谢您的任何回复。
解决方案
showBack
是一种方法,Form
因此如果命令在子类中定义,这将起作用Form
。否则,您将需要一个表单实例来调用它。
showPreviousForm
是一个自定义方法,您需要定义以某种方式显示以前的表单。
推荐阅读
- influxdb - 将查询从 promql 转换为通量
- excel - 如何删除特定数据的整行?
- c# - 如何关闭 ASP.NET 和实体框架为每个请求完成的默认日志记录?
- python - 在 Python 脚本中导入 numpy 时 Golly 崩溃
- javascript - 未执行 Jquery 命令
- terraform - Terraform - 具有多个子网 ID 的无效索引错误
- javascript - 从 JavaScript 加载解压的 Chrome 扩展?
- python - 在 Python 中返回包含 2 个单词的字符串
- kotlin - Feign 404 的后备工厂
- wordpress - 无法更改 wordpress 中的主页内容