黑莓菜单项已弃用
我正在尝试使用 BlackBerry JDE 6.0 的 MenuItem 类,但遇到错误“构造函数 MenuItem String(String, int, int) 已弃用”。我正在使用 MainScreen 类下的子类来实现它。以下是已弃用的示例代码:
public class UiFunMainScreen extends MainScreen{
class LoginMenuItem extends MenuItem {
public LoginMenuItem() {
super("Login", 20, 10);
}
public void run() {
login();
}
}
class ClearMenuItem extends MenuItem {
public ClearMenuItem() {
super("Clear", 10, 20);
}
public void run() {
clearTextFields();
}
}
}
I am trying to use the MenuItem class of BlackBerry JDE 6.0 and I am encountering an error "The constructor MenuItem String(String, int, int) is deprecated". I am implementing it using a subclass under the MainScreen class. below is the sample deprecated code:
public class UiFunMainScreen extends MainScreen{
class LoginMenuItem extends MenuItem {
public LoginMenuItem() {
super("Login", 20, 10);
}
public void run() {
login();
}
}
class ClearMenuItem extends MenuItem {
public ClearMenuItem() {
super("Clear", 10, 20);
}
public void run() {
clearTextFields();
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下版本的代码创建 MenuItem:
来自 RIM BlackBerry API 6.0 文档
通过子类化和实现 Runnable 创建菜单项
如果子类化扩展类必须实现 Runnable 接口,该接口又支持激活时菜单操作的抽象调度。
探索 API。
Use following version of code to create a MenuItem:
from the RIM BlackBerry API 6.0 Documentation
Creating menu items by subclassing and implementing Runnable
If subclassing the extending class must implement the Runnable interface, which in turn supports abstract dispatching of menu actions on activation.
Explore the API.