J2ME Tutorials

31. java.lang.SecurityException: MIDP lifecycle does not support system exit.

By: Henry : 2007-09-16

Description: Usually the Midlets (J2ME programs) doesn't call System.exit(). MIDP applications differ from J2SE applications in the way they terminate. To terminate your MIDlet, you only need to call the MIDlet's notifyDestroyed() method. This signals the AMS that your MIDlet is done executing. The AMS destroys the MIDlet instance and all of its objects. The VM still executes, however.


32. How to get the CLDC and MIDP version from a J2ME program

By: Ivan Lim : 2007-09-16

Description: The CLDC/MIDP supports system properties, which are key-value pairs that represent information about the platform and environment in which MIDP applications execute. Conceptually these are the same type of properties that you find in J2SE. Unfortunately, there is no java.util.Properties class in CLDC/MIDP to facilitate your handling of properties.


33. DateField sample program in J2ME

By: Jagan : 2007-09-16

Description: This example displays the date and time because the constructor call specifies the display of both quantities. The DateField class defines three constants, which let you control what information is displayed.


34. StringItem sample program in J2ME

By: Kamini : 2007-09-16

Description: The StringItem class defines a two-part display component. StringItem objects contain a label and some immutable text. The sample J2ME program shows the pertinent parts of the StringItemDemo code. You can correlate the text in the constructor's two argument parameters with the text on the display. This is a very simple UI component.


35. Gauge sample program in J2ME

By: Lakshmi : 2007-09-16

Description: The J2ME example shown below places four items on a Form: two gauges and a String label for each one. The labels identify the two different types of gauges defined by the Gauge class: interactive and non-interactive. The implementation renders the two types of gauges differently so the user can distinguish their type.


36. Image and ImageItem sample program in J2ME

By: Norman Chap : 2007-09-16

Description: The program below demonstrates the use of the ImageItem MIDP UI component class. An ImageItem is a subclass of Item, so it must be placed in a Form as demonstrated by the listing. Before you can display an image, you must first create an image object. The javax.microedition.lcdui.Image class defines images. To instantiate Image, specify the path name of an image file. Image files must be stored in the Portable Network Graphics (PNG) format. J2ME supports the manipulation of images in this format only.


37. TextBox sample program in J2ME

By: Priya : 2007-09-16

Description: Unlike a TextField, a TextBox is a multiline, editable text area. TextBox is a kind of Screen, not an Item. Because a TextBox is a Displayable, you must create a MIDlet object to demonstrate its use; you can't place it in another Screen or Form, as you can with the components derived from Item.


38. paint() sample program to draw a line in J2ME

By: Reema sen : 2007-09-16

Description: To draw a line, you must specify the (x, y) coordinates of its start and end points. The (x, y) coordinates are defined relative to the point (0, 0), which, at the time the graphics context is created, represents the pixel at the top-left corner of the display. The x coordinate specifies the horizontal distance to the right from column 0 (the left edge of the display), and the y coordinate specifies the vertical distance down from row 0, which is the top of the display.


39. Sample program to draw a rectangle in J2ME

By: Sam Chen : 2007-09-16

Description: You can draw two kinds of rectangles: regular and rounded. Rectangles, like all geometric drawing, can be drawn in different colors by specifying the color of the graphics pen.


40. Sample program to draw a arc in J2ME

By: Tamil Selvan : 2007-09-16

Description: The Graphics class also supports the drawing of arcs. To draw an arc, you must specify six parameters. These parameters are the four quantities that define the arc's bounding rectangle, its start angle, and its end angle. The bounding rectangle is defined by the same four parameters required for rectangles.