Java Reference
In-Depth Information
10.
Now set the name of the widget itself. Select the project, go to the top-level File
menu, and choose WeatherWidget Properties.
11.
Choose MIDlets from the right-hand pane, and rename the MIDlet to
Weather
.
Building and Running for the First Time
Build and run your application by clicking the green arrow. In a few seconds, you'll see
the Sun Java Wireless Toolkit emulator. You can launch the application and explore the UI
you created, or you can quit the application.
■
Tip
If the emulator launches and then immediately exits, check your antivirus and firewall applications to
ensure that it's not blocking the execution of the emulator.
Let's take a look at your handiwork. Listing 3-1 shows the code you created, largely
through manipulating the Flow Designer and Screen Designer.
Listing 3-1.
Code Generated by Using the Flow Designer and Screen Designer
/*
* HelloMIDlet.java
*
* Created on November 19, 2007, 7:58 PM
*/
package com.apress.rischpater.weatherwidget;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
*
* @author Ray Rischpater
*/
public class HelloMIDlet extends MIDlet implements CommandListener {