Thursday, October 25, 2007

MIDP Application, Hello World 2, Using the Source Editor

1 - Choose File > New Project (Ctrl-Shift-N). Under Categories, select Mobility. Under Projects, select MIDP Application and click Next.
2 - Enter HelloWorld2 in the Project Name field. Change the Project Location to any directory on your system.
3 - Check the Set as Main Project checkbox and remove the check from the Create Hello MIDlet checkbox. Click Next.
4 - Leave the J2ME Wireless Toolkit as the selected Target Platform.
5 - Expand "Configuration templates provided by installed CLDC platforms" and J2ME Wireless Toolkit folders. Check the boxes next to each of the configurations.
The IDE will automatically creates a new project configuration for each template listed.
6 - Click Finish. The IDE creates the HelloWorld2 project folder. The project folder contains all of your sources and project metadata.

7 - Right-click the HelloWorld2 node in the Explorer window and choose New > MIDlet

8 - Enter HelloWorld2 as the MIDlet name. Click Finish. The HelloWorld2.java file is created.

9 - Double click the HelloWorld2.java file to display the source code in the Editor.

---------------------
10 - Change the code
public class HelloWorld2 extends MIDlet
to

public class HelloWorld2
extends MIDlet implements javax.microedition.lcdui.CommandListener
{
11 - Add the following text before the startApp() method:

public HelloWorld2() {
}
private void initialize() {
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_helloTextBox());
}

public void commandAction(javax.microedition.lcdui.Command command, javax.microedition.lcdui.Displayable
displayable) {
if (displayable == helloTextBox) {
if (command == exitCommand) {
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(null);
destroyApp(true);
notifyDestroyed();
}
}

}

private javax.microedition.lcdui.TextBox get_helloTextBox() {
if (helloTextBox == null) {
helloTextBox = new javax.microedition.lcdui.TextBox(null, "Test String",120, 0x0);
helloTextBox.addCommand(get_exitCommand());
helloTextBox.setCommandListener(this);
}
return helloTextBox;
}

private javax.microedition.lcdui.Command get_exitCommand() {
if (exitCommand == null) {
exitCommand = new javax.microedition.lcdui.Command("Exit", javax.microedition.lcdui.Command.EXIT,
1);
}
return exitCommand;
}

javax.microedition.lcdui.TextBox helloTextBox;
javax.microedition.lcdui.Command exitCommand;


12 - Add a line initialize(); to the startApp() method, so it looks like the following:

public void startApp() {
initialize();
}

13 - Double click the get_helloTextBox() on the Navigator Window to involve_helloTextBox(). Replace the "test string"
code with the text of your choice. For example, "Hello World 2"

14 -
Choose Run > Run Main Project (F6) from the Run menu.

That's:



Wednesday, October 24, 2007

NetBeans IDE 6.0 Beta 2 just released


NetBeans IDE 6.0 Beta 2 just released on 23 Oct, 2007.

Sunday, October 21, 2007

HelloWorld using NetBeans' Visual Mobile Designer (VMD)

1 - Choose File > New Project. Under Categories, select Mobility. Under Projects, select MIDP Application and click Next.

2 - Enter HelloWorld or what you want in the Project Name field. Change the Project Location to any directory on your system.

3 - Check the Set as Main Project and Create Hello MIDlet check boxes. Click Next.
4 - Leave the J2ME Wireless Toolkit as the selected Target Platform. Click Next.
5 - Expand "Configuration templates provided by installed CLDC platforms" and your target Wireless Toolkit folders. Check the boxes next to each of the configurations.
6 - Click Finish. The application itself is displayed in the Flow Design window of the Visual Mobile Designer.
7 - Click on Screen.This opens the Screen Designer window, and displays the Device screen, which is the only screen available in the application.

8 - In the Properties window, click in the Text field and type in some new text.
9 - Choose Run > Run Main Project (F6) from the Run menu. A device emulator opens to display the results of the executed MIDlet.

10 - In the device emulator window, click on the button below the Launch command. The device emulator launches the MIDlet. That's my first HelloWorld.

11 - Click on the button below Exit to close the MIDlet. Then click on the button in the upper right corner of the device to close the emulator window.

Saturday, October 20, 2007

NetBeans IDE 6.0 Beta 1 is available


NetBeans IDE 6.0 Beta 1

The NetBeans IDE is a modular, standards-based, integrated development environment (IDE) written in the Java programming language. The NetBeans project consists of an open source IDE and an application platform, which can be used as a generic framework to build any kind of application.

The focus of NetBeans IDE 6.0 is improved developer productivity through a smarter, faster editor, and the integration of all NetBeans products into one IDE. Please download it. The NetBeans IDE 6.0 is scheduled to be released in November 2007.

Before you install the IDE, the Java SE Development Kit (JDK) 5.0 Update 12 (version 1.5.0_12) or newer must be installed on your system. If you do not have an installation of JDK 5.0 Update 12 or newer, you cannot proceed with the installation.

J2ME-er

I also want to learn J2ME programming, start from installing development platform, stop to HelloWorld!