HelloWorld

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.RichTextField;

/**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */
public class HelloWorldDemo extends UiApplication
{
    /**
     * Entry point for application
     * @param args Command line arguments (not used)
     */ 
    public static void main(String[] args)
    {
        // Create a new instance of the application and make the currently
        // running thread the application's event dispatch thread.
        HelloWorldDemo theApp = new HelloWorldDemo();       
        theApp.enterEventDispatcher();
    }
    

    /**
     * Creates a new HelloWorldDemo object
     */
    public HelloWorldDemo()
    {        
        // Push a screen onto the UI stack for rendering.
        pushScreen(new HelloWorldScreen());
    }    
}


/**
 * A class extending the MainScreen class, which provides default standard
 * behavior for BlackBerry GUI applications.
 */
final class HelloWorldScreen extends MainScreen
{
    /**
     * Creates a new HelloWorldScreen object
     */
    HelloWorldScreen()
    {        
        // Set the displayed title of the screen       
        setTitle("Hello World Demo");

        // Add a read only text field (RichTextField) to the screen.  The
        // RichTextField is focusable by default. Here we provide a style
        // parameter to make the field non-focusable.
        add(new RichTextField("Hello World!", Field.NON_FOCUSABLE));
    }

    
    /**
     * Displays a dialog box to the user with the text "Goodbye!" when the
     * application is closed.
     * 
     * @see net.rim.device.api.ui.Screen#close()
     */
    public void close()
    {
        // Display a farewell message before closing the application
        Dialog.alert("Goodbye!");     
        super.close();
    }   
}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值