首页 » 黑莓开发 » 黑莓开发:怎么样制作一个弹出框

黑莓开发:怎么样制作一个弹出框

3469 0

今天群里有人问怎么做?一直报报jvm error 104:illegalargumentexception

其实很简单,官方都有例子可以看。

我估计应该是没有clean自己jde下的垃圾东西或者jde配置不对造成的参数错误。

package newpackage;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.PopupScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
/**
*
* @author Tiandi Zhang
*/
public class Demo extends UiApplication {
public static void main(String[] args){
Demo theApp = new Demo();
theApp.enterEventDispatcher();
}
public Demo(){
pushScreen(new mainscreen());
}
}
class mainscreen extends MainScreen{
public mainscreen() {
super();
LabelField title = new LabelField("Popup Demo",LabelField.ELLIPSIS|LabelField.USE_ALL_WIDTH);
setTitle(title);
ButtonField b1 = new ButtonField("Popup a Screen",ButtonField.CONSUME_CLICK);
add(b1);
b1.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().pushScreen(new pscreen());
}
});
}
}
class pscreen extends PopupScreen{
public pscreen(){
super(new VerticalFieldManager(),Field.FOCUSABLE);
add(new LabelField("This is a popup screen."));
}
}

文章评分1次,平均分5.0

本文原始地址:https://www.tiandiyoyo.com/2010/02/%e9%bb%91%e8%8e%93%e5%bc%80%e5%8f%91%ef%bc%9a%e6%80%8e%e4%b9%88%e6%a0%b7%e5%88%b6%e4%bd%9c%e4%b8%80%e4%b8%aa%e5%bc%b9%e5%87%ba%e6%a1%86/
本站所有文章,除了特别注明外,均为本站原创,转载请注明出处来自www.tiandiyoyo.com

您可能还会对以下文章感兴趣:

    没有相关的文章

评论前先开启评论开关: