July 22, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Introducing a Lightweight UI Toolkit: Shake Your User Interface

  • September 25, 2008
  • By Ibon Urrutia
  • Send Email »
  • More Articles »

Figure 5: Main Menu also is a List

Basically, the PlacesDisplay class gets a List of Locations and shows them on screen, until you reach a city (you read the location link and test whether the yahooCode is a digit). It allows you to navigate forward, but to maintain a example clean, it doesn't allow backward navigation. Finally, it simply stores that information on RMS and shows weather info for that city. to do that, I have created some methods on the WeatherMidlet class and I have improved WeatherDisplay to show all cities stored on RMS using Menus.

Menus

I took advantage of another feature of LWUIT: If you add more than two commands to a form, a menu command is generated automatically; this opens a dialog with your options. LWUIT also animates that dialog window with a transition; I will explain that later in this article. In the following code, you will see that you only add commands; LWUIT does all the hard work.

...
Vector citiesStored = actList.getCities();
for (int i = 0; i < citiesStored.size(); i++) {
   YWRecord city = (YWRecord) citiesStored.elementAt(i);
   weatherForm.addCommand(new Command(city.name, COMMAND_CITY));
}
...

Figure 6: A menu with all stored cities is shown

Dialogs

As you've seen, a menu is a little window that is painted in front of your screen. It is really implemented as some special Dialog window. As with desktop applications, you can show a dialog window to warn, inform, or obtain some input from users. By default, all dialogs are modal; they intercept all input and block the background form/window, which is the common scenario when showing a dialog. A mode-less dialog window is planned for future releases of LWUIT.


Tags: mobility



Page 4 of 7



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel