当前页面: 开发资料首页 → Netbeans 专题 → Visual Mobile Designer Custom Components: Creating Mobile Splash Screens
摘要: Splash screens are used to enhance the look and feel of an application. Typically, you use a splash screen when the program starts, or to display a logo or branding information. It gives users the first impression of your application.
Splash screens are used to enhance the look and feel of an application. Typically, you use a splash screen when the program starts, or to display a logo or branding information. It gives users the first impression of your application.
As you'll see in this tutorial, the Visual Mobile Designer (VMD) in the NetBeans Mobility Pack makes it easy to design a splash screen and implement it using the SplashScreen custom component included in the VMD's palette.
This is a quick example that shows you how to add a splashscreen to your Java ME application using the SplashScreen component. You will learn how create a new Mobile Application project with NetBeans Mobility Pack 5.0 and understand the basic features of the SplashScreen custom component.
Before you begin, you need to install the following software on your computer:
If you are new to the NetBeans Mobility Pack 5.0, you should start with NetBeans Mobility Pack 5.0 Quick Start Guide before continuing.
Take the following steps to install SplashScreen example application:
Now that you have seen the SplashScreen component in action, let's go back to the beginning and create this application. To create the application, you will do the following:
SplashScreenExample
in the Project Name field. Change
the Project Location to a directory on your system. From now on, we will
refer to this directory as $PROJECTHOME. SplashScreenExample
project in the Project Window,
then choose File > New File (Ctrl-N) . Under Categories, select Java
Classes. Under File Types, select Java Package. Click Next. splashscreenexample
in the Package Name field. Click
Finish. splashscreenexample
package in the Project window,
then choose File > New File (Ctrl-N) . Under Categories, select MIDP.
Under File Types, select Visual Midlet. Click Next. MySplashScreenMidlet
into MIDlet Name and MIDP Class
Name fields. Click Finish. The SplashScreen component looks like the following when it is added
to the Flow Designer:
Splash Screen
and enter Wait for
10 sec. or press a key to close it
into the Text property.Form
.<Enter Text>
to Press Exit to close
application
.Choose the Exit Command from the Commands section in the Palette, and drag it into the form1 component.
$PROJECTHOME/src/splashscreenexample
folder.
In the Flow design window, click on the Start Point and drag the arrow to the splashscreen1 component. In the same manner, connect the components as shown in the following graphic.
Press <F6> to Run the main project.
Alternatively you could select Run > Run Main Project.
The NetBeans IDE provides API documentation--javadocs--for the SplashScreen component, as well as other components you can use in the VMD. To read the javadocs for the SplashScreen Component:
org.NetBeans.microedition.lcdui
and then SplashScreen
.