私のコードは、BlackBerryのチュートリアルで提供されているコードと実質的に同じですが、Eclipseに構文エラーがあります。私は確かにいくつかの小さなが、私は見ていないが、私の同僚もそれを見つけることができませんでした。どんなアイデアも大歓迎です。ありがとう!Eclipseで簡単なアプリケーションがコンパイルされない(プラグイン付き)
コード:
pushScreen(new ABCScreen());
がエラー:
Cannot make a static reference to the non-static method pushScreen(Screen) from the type UiApplication
ここでは、完全なソースです:
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class AwesomeBBCalculator extends UiApplication {
public AwesomeBBCalculator() {
AwesomeBBCalculator app = new AwesomeBBCalculator();
app.enterEventDispatcher();
}
public static void main(String[] args) {
pushScreen(new ABCScreen()); // ERROR LINE
}
}
final class ABCScreen extends MainScreen {
public ABCScreen() {
super();
// add title
LabelField title = new LabelField("Awesome BlackBerry Calculator",
LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
setTitle(title);
}
public boolean onClose() {
Dialog.alert("Thanks for using the Awesome BlackBerry Calculator!\nGoodbye.");
System.exit(0);
return true;
}
}