Skip to main content

Menu and submenu with command button..?

9 replies [Last post]
sawal_xp
Offline
Joined: 2008-02-12

hi..
how to make command button menu in softbutton, lefr or right.
And the command button has a submenu..

i see like this in some J2Me free application before...in game or another application..
can we do it with LWUIT...?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
seik
Offline
Joined: 2008-07-03

can I add two more question?
everytime I put 3+ commands on the form, it makes the first one go to the lift and creates a menu on the right, my question is: the menu on the right has all the commands, even the first one that had been put alone... can I show only the second and third commands on the menu, without showing the first?
second question: the buttons that call the softbuttons(the right on and left one), can I make them ativate a normal button, instead of a softbutton?if yes, how?

chen

Hi,
1)Can you explain your first question further, I'm not sure I understand.

2)You can modify the Commands list by overriding the createCommandList
method
*
protected List createCommandList(Vector commands){

//manipulate the commands Vector and then call to the parent.
....
super.**createCommandList(commands)*
*}
*
3)The Command is an ActionListener so you can add it to a button and to
the menu.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> can I add two more question?
> everytime I put 3+ commands on the form, it makes the first one go to the lift and creates a menu on the right, my question is: the menu on the right has all the commands, even the first one that had been put alone... can I show only the second and third commands on the menu, without showing the first?
> second question: the buttons that call the softbuttons(the right on and left one), can I make them ativate a normal button, instead of a softbutton?if yes, how?
> [Message sent by forum member 'seik' (seik)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284702
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

seik
Offline
Joined: 2008-07-03

hum..I think I didnt explain well my last question, or maybe I didnt understand the answer XD

I want to create my own buttons to react to some cellphone buttons, like "send" or the two used to access the commom command list{the commands that you add to the form, like "exit" and "select"}
I create a button, and I want it to be like this
{
enable = false, so the user cant select it;
act as a listener, so that if I press "X" button on my cellfone(ex.: send) it will call a command of my choice;
}
thanks

Shai Almog

Hi,
sawal's answer would probably be (if I understood the question
correctly):
UIManager.getInstance().getLookAndFeel().setReverseSoftButtons(true);

This would reverse the directions of the commands.

As to your question, you can just derive Form and override keyPressed/
keyReleased appropriately to invoke your commands. If the user
presses 'X' you can do any action you desire.

Thanks,
Shai.

On Jul 7, 2008, at 6:48 PM, lwuit-users@mobileandembedded.org wrote:

> hum..I think I didnt explain well my last question, or maybe I
> didnt understand the answer XD
>
> I want to create my own buttons to react to some cellphone buttons,
> like "send" or the two used to access the commom command list{the
> commands that you add to the form, like "exit" and "select"}
> I create a button, and I want it to be like this
> {
> enable = false, so the user cant select it;
> act as a listener, so that if I press "X" button on my cellfone
> (ex.: send) it will call a command of my choice;
> }
> thanks
> [Message sent by forum member 'seik' (seik)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284736
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

sawal_xp
Offline
Joined: 2008-02-12

hi shai..
my question is, how to make menu like this in left or right softbutton, ex:

Menu ->item1
------------item2
------------item3->submenu1
-----------------------submenu2
------------item4->submenu1

so, the command button has submenu.From the example list, command button "item3" has submenu, in submenu there are 3 command button...

i want to make like that in my softbutton..
can you help me..:)
can i do what i want it with LWUIT...?

Shai Almog

Hi Sawal,
subcommands aren't currently supported. This is a long standing
debate discussed more in depth here:
http://forums.java.net/jive/thread.jspa?messageID=280150&#280150

I might provide some way of implementing sub commands in a future
blog post however this will require quite a bit of work...

Thanks,
Shai.

> hi shai..
> my question is, how to make menu like this in left or right
> softbutton, ex:
>
> Menu ->item1
> ------------item2
> ------------item3->submenu1
> -----------------------submenu2
> ------------item4->submenu1
>
> so, the command button has submenu.From the example list, command
> button "item3" has submenu, in submenu there are 3 command button...
>
> i want to make like that in my softbutton..
> can you help me..:)
> can i do what i want it with LWUIT...?
> [Message sent by forum member 'sawal_xp' (sawal_xp)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284987
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

sawal_xp
Offline
Joined: 2008-02-12

ok shai..i understnd now..;)

i hope, oneday, JME programming LWUIT, may be you..:), can help us to create the component that make menu and the subcommand in our softbutton in LWUIT...:)

thaks shai...:)

vilastalewale
Offline
Joined: 2007-02-22

Hi i have the same problem
i have menu list in which i had dynamically added command in the menu list using actionPErformed(ActionEvent e). now i m not getting how to get event of that command in the menu list.
structure is like this

back Menu

Menu command contains list of commands.
how to handle the event of command in the list of Menu Command.

Pls help me out.

Shai Almog

Hi,
Commands should work seamlessly with a menu and without. I don't
quite follow your question, if you can show what you are trying to do
in code it might clarify things.

> Hi i have the same problem
> i have menu list in which i had dynamically added command in the
> menu list using actionPErformed(ActionEvent e). now i m not getting
> how to get event of that command in the menu list.
> structure is like this
>
> back Menu
>
> Menu command contains list of commands.
> how to handle the event of command in the list of Menu Command.
>
> Pls help me out.
> [Message sent by forum member 'vilastalewale' (vilastalewale)]
>
> http://forums.java.net/jive/thread.jspa?messageID=316759
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]