×

Discussion Board

Results 1 to 8 of 8

Thread: j2me Menu

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Question j2me Menu

    Hey guys

    I am new to j2me. Have only been using it for 2 days now. Im busy building a app for practice. Usually googling helped me with all my problems. But not now. I have tried googling/binging/yahooing, everything. lol. So was hoping you guys can help me out.

    I need to make a simple menu of images and not text. I tried using a List and all other things, but they do not cater for my needs. From googling I found that I need to build a custom wiget for that. This is where I need help.

    At the moment I have a class called NavList which extends CustomItem. This has an append method that allows me to add images to. Images get added to a Vector. Then the paint method uses g.drawImage to display the images from the Vector. That all is perfect and working. I then append this custom item to my form and it works perfectly. My only problem is I have no idea how to handle the click event when you click on the buttons, I tried adding commands SCREEN,LIST, etc But nothing seems to work and I can find no answers.

    So, please help me get this working. Is my list the best way of doing it? Or would it be better to extend List or Canvas instead of customItem?

    Thanks for any feedback guys. I really appreciate it.

  2. #2
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    174

    Re: j2me Menu

    Quote Originally Posted by NightStalkerDNS View Post
    Hey guys

    I am new to j2me. Have only been using it for 2 days now. Im busy building a app for practice. Usually googling helped me with all my problems. But not now. I have tried googling/binging/yahooing, everything. lol. So was hoping you guys can help me out.

    I need to make a simple menu of images and not text. I tried using a List and all other things, but they do not cater for my needs. From googling I found that I need to build a custom wiget for that. This is where I need help.

    At the moment I have a class called NavList which extends CustomItem. This has an append method that allows me to add images to. Images get added to a Vector. Then the paint method uses g.drawImage to display the images from the Vector. That all is perfect and working. I then append this custom item to my form and it works perfectly. My only problem is I have no idea how to handle the click event when you click on the buttons, I tried adding commands SCREEN,LIST, etc But nothing seems to work and I can find no answers.

    So, please help me get this working. Is my list the best way of doing it? Or would it be better to extend List or Canvas instead of customItem?

    Thanks for any feedback guys. I really appreciate it.

    Hi canvas would be better option for your problem. draw images on canvas.
    Regards,
    Snehal

  3. #3
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: j2me Menu

    HI stalker as far as detecting key events you hav to write keypressed method as we did in canvas and for other key related functions for incorporating more user friendly UI like pointer pressed, keyReleased but as far as going this way is although more portable than using a canvas which is more visually appealing I never tried it using ur approach so can say exactly that it will work bt canvas approach is what I found more better nd is visually sound
    Regards,
    Saurabh

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Re: j2me Menu

    Hi, ok I will change it to a canvas, thats no problem. But could you please give me some advice on how to setup the click or keypressed commands on it? How do I know which one is selected? And is there a way to change the image to another image when and item is selected to show the user their current selection? Sorry if this is funny questions, but I come from a C# website background.

    Thanks for the help

  5. #5
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: j2me Menu

    well personally I never worked with customitem but I looked at class more or less it is to an extent close to canvas class the method used in canvas for key input can also be used in customitem as far as getting the item clicked u can create a array of total element and on arrow keys detection but again I never used it so cant be sure
    Regards,
    Saurabh

  6. #6
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Re: j2me Menu

    Thats fine, I will change it to a canvas. But I do not no how to implement the keypress event or the array from arrow key. could you give me some examples or links I could read up on how to do it?

    Thanks for the help

  7. #7
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    174

    Re: j2me Menu

    Quote Originally Posted by NightStalkerDNS View Post
    Thats fine, I will change it to a canvas. But I do not no how to implement the keypress event or the array from arrow key. could you give me some examples or links I could read up on how to do it?

    Thanks for the help
    hi

    see these example of canvas

    http://www.java2s.com/Code/Java/J2ME...odeExample.htm
    Regards,
    Snehal

  8. #8
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Re: j2me Menu

    Thanks a lot. The linked helped a lot. FYI, the keyPressed event does not work on a CustomItem. But changing it to a canvas worked perfectly. Thanks a lot

Similar Threads

  1. can we launch our J2ME application from nokia softkey menu directly
    By rahulkrishna in forum Mobile Java General
    Replies: 3
    Last Post: 2009-08-25, 12:40
  2. unable to activate J2ME polish GUI
    By elaltaico in forum Mobile Java General
    Replies: 2
    Last Post: 2009-05-18, 09:08
  3. CustomMenu System Menu Problem - Any Solution?
    By Vignesh.M in forum Mobile Java General
    Replies: 1
    Last Post: 2009-04-03, 08:00
  4. j2me application Link on Gallery Image Menu
    By prajapati.ajay in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2009-03-21, 05:15
  5. Menu bar in FEP
    By kdinn in forum Symbian
    Replies: 0
    Last Post: 2004-05-27, 08:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×