JavaMEComponent MELibrary
Contents |
Abstract
This document is a part of Java ME Custom Component Creation tutorial.
It will help you to implement new Java ME component based on existing SplashScreen component implementation (NetBeans extension of existing Java ME components).
We will add status string to the display. Component class will be extended with three methods to manage displayed status message:
- void setStatus(int) - set finished percents
- int getStatus() - get finished percents
- void setStatusPrefix(String) - prefix to add to status message
In our implementation we will extend showNotify() method to start process that will update status value periodically.
Steps
If you not familiar with NetBeans Java ME plugin look at this Document before you start: NetBeans 6.0 CLDC/MIDP Development Quick Start Guide
- Create new Java ME Mobile Application project
- Name it SplashScreenExtLibrary
- Don't create Hello midlet
- Add new package org.netbeans.microedition.lcdui.custom to created project
- Add new Java Class to just added package
- Name it SplashScreenStatus
- Replace SplashScreenStatus class implementation with the following code. Then we will describe new implementation.
- To create SplashScreenStatus based on existing org.netbeans.microedition.lcdui.SplashScreen implementation, we have made the following changes
- extends clause is added
public class SplashScreenStatus extends SplashScreen
- constructor with Display parameter is added
- extends clause is added
- To create SplashScreenStatus based on existing org.netbeans.microedition.lcdui.SplashScreen implementation, we have made the following changes
- We have extended SplashScreen by adding status string at the Bottom of display
- void setStatus(String) to set status string
- String getStatus() to get status string
- have overrided paint(Graphics) method to draw status string on display
- have overrided showNotify() method to update status text
- We have extended SplashScreen by adding status string at the Bottom of display
- Add to project Libraries and Resources list NetBeans MIDP Components library, which contains org.netbeans.microedition.lcdui.SplashScreen
- Fix imports in SplashScreenStatus source by using Ctrl+Shift+I shortcut or Fix Imports command from editor context menu
- build SplashScreenExtLibrary project
Result
As a result of this tutorial you get Project with new Java ME component SplashScreenStatus implementation. Project is compiled into jar file SplashScreenExtLibrary/dist/SplashScreenExtLibrary.jar
You may download zipped project created in this tutorial: SplashScreenExtLibrary_JavaMEComponent_MELibrary.zip
NOTE: To run project from zip file you have to change NetBeans Platform to one registered in your Netbeans IDE.
Now you can continue with the next tutorial step: Part Two: Java ME Visual Designer component
Back to Java ME Custom Component Creation tutorial


