我是非常新的黑莓应用程序。黑莓ButtonField应用程序示例
现在试图建立在黑莓使用eclipse计算器:
,所以我增加了一个按钮(ButtonField
),我的第一个目标是当按下此按钮,我想显示
“喜..现在你可以尝试使用文本字段“
这里我把我的代码,请通过它。
Launcher.java
public class Launcher extends UiApplication {
public static void main(String[] args) {
Launcher theApp = new Launcher();
theApp.enterEventDispatcher();
}
private Launcher()
{
this.pushScreen(new MainScrn());
}
}
MainScrn的.java
public class MainScrn extends MainScreen implements FieldChangeListener {
public MainScrn() {
LabelField lf_hello = new LabelField();
lf_hello.setText("Hello, World!");
lf_hello.setBackground(BackgroundFactory.createSolidBackground(124));
ButtonField mySubmitButton = new ButtonField("clickMe");
mySubmitButton.setChangeListener(this);
this.add(lf_hello);
this.add(mySubmitButton);
}
public void fieldChanged(Field field, int context) {
System.out.println("hi.. now you can try with text field");
}
}
招呼什么错了这一点。 ?请帮助.. 它会很简单,但我现在不是?