Sunday, March 14, 2010

J2ME - Screen and visual user interfaces

J2ME provides a variety of methods of showing objects and  controls on screen. You can use typical form like screens that will have text boxes, drop downs and buttons for takeing input from user or you can use custom drawing capable panels called Canvas.

Following diagram shows a typical hierarchy of the J2ME user interface classes:

As you can see, every visual element shown on J2ME screens is a sub-class of Displayable. All these classes are found inside javax.microedition.lcdui package or its sub-packages. Displayable hence is also found at javax.microedition.lcdui.Displayable. Screen class is hardly ever used for direct screen display and the most common screen item on J2ME apps is either Form or a Canvas.

Form is a screen that can display other controls like buttons, text fields and check boxes on top of it. Canvas is a more general drawing  board on which you can create visual interfaces by drawing lines, arcs, text, colors and images.

At times, there is no need of a full fledged Form and a full-screen TextBox or a List could do the trick as shown in the hierarchy. Alerts are a way of showing infromation or errors to the user. We will study further about these classes in the later articles.

Related Articles:

J2ME - Form Example
J2ME - Canvas Example
J2ME - List Example
J2ME - Alert Example
J2ME - TextBox Example

No comments:

Post a Comment