2011-04-25 34 views
0

我得到了書黑色漿果6發展。 我能夠使midlet示例工作,但不是CLDC程序的第一個示例。它似乎從來沒有得到的代碼,當我運行應用程序,我得到一個空白的白色屏幕。 我試圖把一個斷點,但它從來沒有關閉。試圖寫一個你好世界CLDC黑莓程序

下面是代碼

package test.org; 
import net.rim.device.api.ui.UiApplication; 
import net.rim.device.api.ui.component.*; 
import net.rim.device.api.ui.container.*; 

public class cHelloUniverses extends UiApplication{ 


    public static void main(String[] args) 
    { 
     (new cHelloUniverses()).start(); 
    } 


    public void start() 
{ 
    MainScreen main = new MainScreen(); 
    LabelField label= new LabelField("Hello Ted"); 
    main.add(label); 

    UiApplication app = UiApplication.getUiApplication(); 
    app.pushScreen(main); 
    app.enterEventDispatcher(); 

} 


} 

回答

0

更換您的start()方法與此:

public void start() 
{ 
    MainScreen main = new MainScreen(); 
    LabelField label= new LabelField("Hello Ted"); 
    main.add(label); 

    this.pushScreen(main); 
    this.enterEventDispatcher(); 

} 
+0

你好,謝謝,還是llearning爪哇。 – 2011-04-26 22:05:07