J2ME Tutorial

Java ME was designed by Sun Microsystems and is a replacement for a similar technology

J2ME Tutorial

J2ME Tutorial

     

J2ME kxml

  1. Java Platform Micro Edition
    Java ME was designed by Sun Microsystems and is a replacement for a similar technology, Personal Java. Originally developed under the Java Community Process as JSR 68, the different flavors of Java ME have evolved in separate JSRs.
     

  2. MIDlet Lifecycle
    By default MIDlet is in the paused states. when the application is executed by default startApp() method will call and when close the application the destroyApp() method will be called.
     

  3. Source code of 'jad' and 'properties' file
    Java Application Descriptor
    (JAD) filename extension is .jad and media type is text/vnd.sun.j2me.app-descriptor, which developed by the Sun Microsystems, Inc.
     

  4. J2ME Hello World Example
    This is the simple hello world application. In this example we are creating a form name "Hello World" and creating a string message "Hello World!!!!!!!".
      

  5. Creating MIDlet Application For Login in J2ME
    This example show to create the MIDlet application for user login . All MIDlet applications for the MIDP ( Mobile Information Device Profile) derived from  MIDlet class and it play a role as a mediator between the application and the environment in which the application runs.
     
      

  6. Text Field MIDlet Example
    This example illustrates how to insert text field in your form. We are using here two TextField (name and company). We are taking both TextField variable in to the constructor (TextFieldExample) of the class.
     
     

  7. J2ME Contact List
    This example illustrates how to create your phone book. In this example we are taking three SCREEN button ("Next", "New", "Exit") and taking two TextBox ("name", "number").
      
     

  8. Date Field MIDlet Example
    This example illustrates how to insert date field in your form. We are using here two fields DateField (datein and dateout) and initialize a final static variable DATE which is 0.
     

  9. J2ME Button MIDlet
    This example illustrates how to create command button in your form. Command class build to bind only the semantic information of the command it means  command is not the actual action its contains only information about command.
     

  10. J2ME CheckBox ChoiceGroup MIDlet
    This example illustrates how to create check boxes in to your form. In this example we are creating a Form("Technologies") that is having four different choices, ChoiceGroup("JAVA", "J2ME", "J2EE", "JSF"). 
      

  11. A MIDlet Example to execute Alert Message with an Image
    In this "Alert Message" example, you will learn how to send an alert message to user whenever an action is called. The example have two different options 1. "ok" and option 2. "Cancel".
      

  12. J2ME Alert Example
    This example illustrates how to create  alert through sound. In this example we are using AlertType class for the different alert. 
      

  13. Radio Button in J2ME
    In this tutorial you will see the MIDlet Example that is going to demonstrate, how to create the radio button in J2ME using MIDlet. The radio button is use to choose only one option at a time.
      

  14. J2ME List Image
    This example illustrates how to create list with image symbol. In this example we are trying to create list using of List class.
      

  15. List in J2ME
    This example illustrates how to create a Exclusive List. The Exclusive List is used to select only one list element at a time.
      

  16. J2ME Canvas Example
    This example illustrates how to create a game using GameCanvas class. In this example we are extending GameCanvas class to draw the circle and rotate the circle continuously.
      

  17. Creating Canvas Form Example
    This example shows that how to use the Canvas Class in a Form. In this example we take two field in which integer number passed from the form and result will display on a Canvas circle.
      

  18. Creating Menu Using Canvas Class
    This example shows how to create the menu and call the canvas class to show the toggle message.
      

  19. Creating Multiple Type List
    This example is shows how to create the list which has multiple type choice option.
       

  20. J2ME Ticker Example
    This is the simple Ticker example which is used to auto scroll the data on the top of the form. It continuously scroll the data.
     

  21. J2ME Thread Processing Example
    In the given example, you will learn about the thread and how thread works in J2ME application. An application can run multiple activities simultaneously using thread. Here we have defined different states of thread...
      

  22. Draw Line in J2ME
    In this example we are going to show you how to draw a line using J2ME. Please go through the below given J2ME syntax that includes all the package, methods and class to draw a line. 
      

  23. Draw Rectangle in J2ME
    In this series of J2ME examples and tutorials, we have introduced you with it's various features with examples. Now in the given example, you will learn about creating rectangles in J2ME.
      

  24. Draw Font Using Canvas Example
    This example is used to draw the different types of font using Canvas class. The following line of code is used to show the different style, size and faces of font.
     

  25. Draw String Using Canvas
    This example is used to draw string on different location which is shown in figure. The given code is used to show, how to draw string at different locations.
      

  26. Interactive, Non-Interactive Gauge Example
    This example shows, how to create the Gauge class to draw the interactive and non-interactive gauge which is used to display the volume label.
     

  27. Creating Volume Bar Using Gauge Class
    This example is all about creating a volume bar using Gauge class. We are creating the object of Gauge class that contains the following parameters label, interactive, maxValue and initialValue and it has been set with the form.
     

  28. Image Item Using Canvas Example
    This example is will show you how to create the image at the top center of the screen.
      

  29. Image Icon Using Canvas Example
    This Example is going to draw a clip with SOLID line. In this picture only solid line show the clipping area.
     

  30. Draw Clip Area Using Canvas
    This Example is going to draw a clip with SOLID line. In this picture only solid line show the clipping area.
      

  31. Player Class in J2ME
    In J2ME, player class is used to play the .wav music, that is the only reason of using the class in our small application to create multimedia sounds.
      

  32. Draw arc in J2ME
    The given example is going to draw an arc using canvas class of J2ME. You can also set a color for it, as we did in our example.
      

  33. Building a J2ME sliding menu with text and images(part-1)
    This example will show, how to create an image icon to perform the next action or next image from the list every time it's been clicked. So if you want to go from one icon to another icon by the nice sliding effect, you have to run the given example.
      

  34. Building a J2ME sliding menu with text and images(part-2)
    In the given J2ME Menus example, we have explained to create two different buttons that is going to perform as a back and forward buttons.
      

  35. Video Player MIDlet Example
    This example is all about how to play the MPEG files on your mobile device. To play the video file we have to import the javax.microedition.media.control package and certain sub-package that are required for the application. 
     

  36. User Define Alert Example
    Creating a user defined alert message, In the given example we have created a image that can be fill with some colors and text. The following source code shows how to create the image, how to set the color and how to draw string.
      

  37. Ring Tones MIDlet Example
    In this example only two Ring Tones are created using Player class.
     

  38. Pointer Example
    This type of example is basically used in touch screen technology, here we are trying to create a pointer which location is based on the screen touch pointer.
      

  39. Media MIDlet Example
    Creating more then one player in a MIDlet, Here we have created an 'item' object for Hashtable and put all 'wav' file in this table with object 'key' and object 'value' which maps the keys to value. 
     

  40. Get Help MIDlet Example
    This example illustrates how to take help from any other text file which is stored in res folder in your MIDlet. In this example we are creating a form which name is "New Form".
      

  41. Different Size of Font MIDlet Example
    This example simply shows the different size of font.
      

  42. Audio MIDlet Example
    This example illustrates how to play audio songs in your mobile application by creating a MIDlet. In the application we have created a player for an audio song by using of javax.microedition.media API.
      

  43. Access URL
    This example is used to access the data from the specific url. The Stream Connection is used to connect the application to the specific url by Airtime (connect to the internet).
      

  44. Text MIDlet Example
    With the help of text MIDlet example, we are going to show text using canvas class at different locations on the screen.
      

  45. Arc MIDlet Example
    In the previous draw arc example, we have explained how to draw an arch on the screen. But in this example we are going to show how to draw arc at different locations.
     

  46. Simple Line Canvas Example
    This is a simple example of drawing lines using canvas class in J2ME. In this example we are creating three different lines at different locations and form.
     

  47. Graphics MIDlet Example
    This is the another graphic example, where we are going to draw a image that look and act like satellite and earth. For creating these types of graphics in J2ME we use MIDlet's.
     

  48. Rectangle Canvas MIDlet Example
    The example illustrates how to draw the different types of rectangle in J2ME. We have created CanvasRectangle class in this example that extends to the Canvas class to draw the given types of rectangle.
      

  49. J2ME Draw String
    In the previous examples, we learned about drawing different graphics on the screen. Here in this example, we are going to show the string in J2ME.
      

  50. Line Canvas MIDlet Example
    In this example, we are going to draw to different lines which cross to each other on the center of the mobile window using Canvas class. "CanvasCrossLine" class created by us extends the Canvas class to draw both the lines.
     

  51. Align Text MIDlet Example
    With the help of the canvas class, we can draw as many as graphics we want in our application. Similarly we can also set the different alignment to the text.
      

  52. Text Example in J2ME
    In J2ME programming language canvas class is used to paint and draw the diagrams. Using the same canvas class we are going to draw a box around the text in our show text MIDlet Example.
     

  53. J2ME Canvas KeyPressed
    This tutorial is going to show you how to handle keypressed event in J2ME using canvas class. After going through the given example, you will be able to show different output against different keypressed actions.
      

  54. Co-ordinates MIDlet Example
    In this example the CoordinatesCanvas class extends the Canvas class  to draw the image and fill color as given below in the figure. 
     

  55. J2ME Record Store MIDlet Example
    This is a simple program to record data and print it on the console.
     

  56. J2ME Animation using repaint( ) method
    In this part of J2ME Image Tutorial, we are going to show you how to create an Image with animation. Here we have create a class called ImageAanimation that extends MIDlet and implements the CommandListner class.
      

  57. Immutable Image MIDlet Example
    This is the immutable image example, which shows how to create a immutable image in MIDlet. In this example we are creating a image without using of canvas.
     

  58. Immutable Image using Canvas Class
    This is the immutable image example which shows how to create the immutable image using canvas. In this example ImageCanvas class extends the Canvas class to create the immutable image.
      

  59. Mutable Image
    This is the Mutable image example which shows how to create the mutable image using canvas class.
     

  60. J2ME Draw Triangle, Rectangle, Arc, Line Round Rectangle Example
    In this serious of J2ME tutorial, we are going to describe how to draw a triangle, rectangle, arc, line or a round rectangle in one small application. Although we have already explained you all these examples separately but in this section we are going to merge them in one.
      

  61. List in J2ME
    J2ME Canvas List Example will explain you, how to create list of items. In this example we are going to create a simple list of text, that will show the selected item on the same screen.
     

  62. J2ME Calendar Application
    Creating a calendar is a very basic example to learn any programming language. At our website (roseindia.net), you can find many examples on creating calendar in Java, JavaScript etc.
      

  63. J2ME Canvas Repaint
    In J2ME repaint is the method of the canvas class, and is used to repaint the entire canvas class. To define the repaint method in you midlet follow the given syntax.
     

  64. J2ME Crlf Example
    The given J2ME Midlet, discuss about how to show the messages in different line and row. In this example we have created an object called clrf that is further used to break line and row to show the message in correct readable format.
     

  65. J2ME Command Class
    In the given J2ME Command Class example, we have set the various commands namely, screen, back, cancel, ok, help, stop, exit and item to the Midlet.
     

  66. J2ME Record Store Example
    In this Midlet, we are going to read string data and write by using the RecordStore class. The package of the RecordStore class is the javax.microedition.rms.
     

  67. J2ME Form Class
    In this J2ME Extends Form example, we are going to discuss about form, extending form in our class and appending values to it.
      

  68. J2ME Current Date And Time
    This is a simple J2ME form example, that is going to show the current date and time on the screen. Like core Java J2ME too use the same  java.util package to show the current date as well as current time on the screen.
      

  69. J2ME Display Size Example
    In the given J2ME Midlet example, we are going to display the size of the screen. Like a below given image 1, the midlet will print few items on the screen and the screen size will be displayed at the command prompt (image 2).
     

  70. J2ME Enumeration Example
    Enumeration is an Interface that comes with the java.util package that can be implement by an object. After going through the example you will be able to run a video file using interface enumeration in J2ME.
      

  71. Appending string in J2ME Form
    In the previous example, you learned about how to add items in to the form. In this example we are going to add string into the form. Both examples are almost same but the only difference is that this time we are using append string instead of append item.
     

  72. J2ME Draw Triangle
    As you already aware of the canvas class and it's use in J2ME application, we are using canvas class to draw the triangle on the screen. In this example you will learn how to draw a triangle and filling it with particular color
      

  73. J2ME Convert Date To String
    As in the previous example, you have learned about how to print the current date on the screen. But in this example we are going to convert the date into string.
     

  74. Appending Image into the J2ME Form
    After adding item and string, now we are going to add image into the J2ME Form.
     

  75. Custom Item in J2ME
    In J2ME applications, Custom Items can be created by programmers and they can also set their look and feel as these custom item have their own method called paint().
      

  76. J2ME Timer MIDlet Example
    This Example shows how to use of timer class. In this example we are using the Timer class to create the time of execution  of application and the TimerTask class is used to create the counter of timer which is executed after 5000 ms
      

  77. J2ME RMS Sorting Example
    This example simply shows how to use of RMS package. In this example we are going to sort the specified string by the implementing of RecordComparator interface
     

  78. J2ME Read File
    In this J2ME application, we are going to read the specified file.
      

  79. J2ME Random Number
    In this application we are going to generate the random number using Random class. The Random class within the java.util package and we can use it by importing the java.util.Random package. 
      

  80. J2ME Label Example
    This is the simple create label example in which we create an StringItem to display the "UserId" as a label text. In the given application we are using setLabel to set the new label to the ItemString.
      

  81. J2ME KeyEvent Example
    This application illustrates to find the key code of each key with its value.
      

  82. J2ME Key Codes Example
    This application illustrates how to print the key value with the current key pressed on the canvas.
     

  83. J2ME Item State Listener Example
    In this application we are going to shows how to implement the ItemStateListener interface in the j2me midlet.
     

  84. J2ME Image Example
    In this application we are going to simply create an image using canvas class. In this class we are creating the image and a thread to run the image.
      

  85. J2ME Image Item Example
    This application illustrates how to create the image and imageItem using Image and ImageItem class respectively. In this example we are going to create an image using Image Class and imageItem using ImageItem class.
     

  86. J2ME Icon MIDlet Example
    In this example we are going to create icon list of different sizes. We are creating here a IconList class, in this class we inherited the property of List class.
     

  87. J2ME HashTable Example
    To use the HashTable, java.util.Hashtable package must be imported into the application. Generally HashTable are used to map the keys to values and these keys or values could be any null object. 
      

  88. J2ME Event Handling Example
    In J2ME programming language, Event Handling are used to handle certain type of events that are generated at the time of loading MIDlet on the mobile screen.
     

  89. J2ME Video Control Example
    This Application explain the use of Video Control. The work of video control is used to controls the display of video.
      

  90. J2ME Vector Example
    This application illustrates how we can use Vector class. In this example we are using  the vector class in the canvas form.
     

  91. J2ME Timer Animation
    This application illustrates how to use the Timer class and implement it in the canvas class. In this Tutorial we have given you a good example, which helps you to understand using of timer class for drawing the canvas.
      

  92. J2ME Text Box Example
    This application illustrates how to create the text box using TextBox class. The TextBox class is a Screen that allows the user to enter and edit text.
      

  93. J2ME Record Listener
    This application illustrates to implement the RecordListener interface with the RecordStore class for receiving Record Changed, Added, Deleted events from a record store.
     

  94. J2ME Audio Record
    This example is used to record the audio sound  and play the recorded sound.
     

  95. J2ME Record Data Base
    This Application is used to explain how to store data in the database. In this example we are going to import the javax.microedition.rms package to access the RecordStore class.
      

  96. J2ME RMS Read Write
    This Application specially tries to explain how to read and write the data using RecordStore class.
     

  97. J2ME Frame Animation 
    This application shows to set the Frame Animation and implement it in the canvas class. In this example we are creating a frame using Gauge class.
     

  98. J2ME Frame Animation2
    This example illustrates same as in the previous example, but here we are creating four blocks and set five frame manually. The whole example shows you to create the frame and blocks.
      

  99. J2ME Cookies Example
    This Application is used to find the cookies value of the servlet. In this example we are creating a MIDlet (CookieMIDlet) for access the servlet.
     

  100. J2ME Servlet Example
    This is the simple servlet tutorial. In this tutorial we shows you, how to create the servlet and implement it with the midlet.