This section briefly demonstrates the main components of J2ME GUI. For detailed
documentation on any of these components, please refer to the
Javadoc reference manual.
Because of J2ME GUI's flexibility, it's possible to build very rich user interfaces,
especially when resources are not a constraining factor. However, even with resource
limitations, J2ME's wide range of style properties allow for a myriad of possibilities.
Larger forms and containers will get a scrollbar automatically by default, but this
can be set explicitly as well. All components have style properties for the following
states: Normal, Disabled, Focused, Pressed, and Editing. Not all components are
able to enter all these states. For components that can be edited, the editing mode
can be entered and exited by clicking on the component (via the OK / Select button
of the navigational pad).
The navigational keys are used to move focus to the closest component in the direction
that was pressed. Disabled components cannot receive focus. If a focusable component
cannot be found in the direction that was pressed, the screen will scroll in that
direction. If the end of the form is reached, the form will jump to the top and
vice versa. This provides users with an intuitive navigational system for your applications.
Basic text can be displayed by using a label component. The built-in fonts of the
handset are used, which includes System, Proportional, and Monospace. Font size
options are small, medium and large. Font styles can be any combination of underlined,
bold, and italic. As with all components, the border and background can also be
customized or set to transparent.
Other than command menus, you can also add buttons to your user interface. Alternatively,
you can add link buttons which is similar to links on web pages. Links have a URL
property that can be used for conveying other data as well. Links will also indicate
if they have been clicked / visited. This is the default behavior, but it can be
changed. Links can also have image glyphs.
J2ME GUI also provides image components. Images can be loaded from the JAR file,
or from any other source that returns an image object. As with all components, the
exact coordinates of image components can be controlled, as well as their z-order,
allowing overlapping and layering of images. All image formats supported by the
handset is also supported by the image component, but it is recommended that you
only use PNG images to ensure compatibility with all supported handsets. Transparent
PNG images can also be used on devices that support this, but it is not recommended
that you assume this capability is available. Also, some devices only support 1-bit
transparency instead of 8-bit alpha blending.
Similar to desktop applications, J2ME GUI also offers checkboxes and radiobutton
components. These function in exactly the same way as their desktop counterparts.
Similarly then, to add more than one radiobutton list to a form, the radiobuttons
for each group should be added to their own container. Containers are similar to
forms, since they can hold any number of components, including nested containers,
and they are scrollable.
You can also list multiple user options in listboxes or comboboxes. These are also
similar in behavior and appearance as their desktop counterparts. To select an item
in a listbox, click on the focused listbox to activate it, choose an item and click
on it to select it. To open a combobox's dropdown menu, click on it and select the
desired dropdown menu item. Items in listboxes and comboboxes can also have image
glyphs. It is also possible to add non-standard components to them. The items will
automatically be arranged in list form.
J2ME GUI offers a standard textbox with support for QWERTY and non-QWERTY devices.
For non-QWERTY devices, the text input mode can be changed and a special symbols
menu can be opened. The default keypad layout is set to resemble that of Nokia devices,
but the layout is fully customizable. Key repeats and delays can also be customized.
With the ability to create custom components based on J2ME GUI's components, and
continued expansion of our library, you will no longer be constrained by limited
interfaces usually associated with mobile handsets.
Since version 1.2, J2ME GUI supports a fullscreen menu system as well as touch screen support.