Results 1 to 4 of 4

Thread: J2ME basic Example

  1. #1
    Join Date
    Nov 2009
    Posts
    580

    J2ME basic Example

    Hi, Can anyone tell me, that how to write a code in j2me? I want to get basics about the java j2me. If you provide some information about this, then it will help me to improve my knowledge. If it is possible to provide some basic information from your knowledge then it will help me a lot. As it is simple to learn from someone than using books. So, please reply me.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: J2ME basic Example

    Hi, I think you will need to know the code below. It is the starting example for each language of programming. So, I am giving you that first. So take a look on it.
    Code:
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    
    public class Hello extends MIDlet
    {
      private Form frm;
      private Display dis;
    
      public Hello()
    {
        super();
    }
    
      public void startApp()
    {
        frm = new Form("Hello World");
        String msg = "Hello World.....";
        form.append(msg);
        dis = Display.getDisplay(this);
        dis.setCurrent(form);
      }
    
      public void pauseApp()
    {
    }
      
      public void destroyApp(boolean unconditional)
    {
        notifyDestroyed();
      }
    }

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: J2ME basic Example

    Hey, for you to get basic knowledge about the j2me I am giving you code below which will print the hello world, So use to to know more about the j2me. The code below will Print "Hello World" in a Mobile Phone Using J2ME. You can see the output with the help of simulator.


    Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    
    public class HelloWorld extends MIDlet implements CommandListener 
    {
        private Command cmd;
        private TextBox t1;
    
        public HelloWorld() 
    {
            cmd = new Command("Exit", Command.EXIT, 1);
            t1 = new TextBox("Hello world MIDlet", "Hello World!", 25, 0);
            t1.addCommand(exitCommand);
            t1.setCommandListener(this);
        }
    
        protected void startApp() 
    {
            Display.getDisplay(this).setCurrent(t1);
        }
    
        protected void pauseApp() {}
        protected void destroyApp(boolean bool) 
    {
    }
    
        public void commandAction(Command cmd1, Displayable disp) 
    {
            if (cmd1 == cmd) 
    {
                destroyApp(false);
                notifyDestroyed();
            }
        }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: J2ME basic Example

    Hello, I am also beginner in java. Also wanted to know the java j2me. So, if anyone give me some or the other tricks about the j2me and java, it will be helpful to me. So, please give me some basic code by using of which I can able to get some more information about this. So, if possible give me some programs regarding this. I am waiting for your reply. Your reply will help me to improve my knowledge. So just reply me with some basic concepts.

Similar Threads

  1. kxml2 and J2ME
    By Galbraith in forum Software Development
    Replies: 4
    Last Post: 17-04-2010, 03:27 AM
  2. How to parse XML in J2ME
    By Abigail101 in forum Software Development
    Replies: 5
    Last Post: 19-02-2010, 03:39 AM
  3. How to send sms using J2Me?
    By Amaresh in forum Software Development
    Replies: 3
    Last Post: 28-11-2009, 12:35 PM
  4. J2me
    By manjava in forum Software Development
    Replies: 1
    Last Post: 24-10-2009, 08:56 AM
  5. Which DBMS for J2ME?
    By EDALENE in forum Software Development
    Replies: 3
    Last Post: 09-10-2009, 06:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,486,421.00825 seconds with 16 queries