The Source for Java Technology Collaboration

Home » java.net Forums » Mobile & Embedded » LWUIT

Thread: Disable command menu items

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: Oct 23, 2008 3:33 AM by: alrocar
alrocar

Posts: 22
Disable command menu items
Posted: Oct 13, 2008 2:44 AM
  Click to reply to this thread Reply

Hello,
I need to enable/disable menu commands. I've implemented a MenuRenderer that 'ignores' my disabled commands, avoiding them to have the focus. But the better solution I think it was to ignore the action events on the menu command, for example, the mouse click event. Can you guide me to reach that behaviour on my menu commands?

Thanks.

Alberto

f_beullens

Posts: 6
Re: Disable command menu items
Posted: Oct 14, 2008 1:36 AM   in response to: alrocar
  Click to reply to this thread Reply

How about creating your menuaction with Action(s) and setting these actions enabled/disabled see AbstractAction

alrocar

Posts: 22
Re: Disable command menu items
Posted: Oct 14, 2008 6:39 AM   in response to: f_beullens
  Click to reply to this thread Reply

Thanks for your reply.

I think it would be enough for my purposes to override the actionPerformed method of my custom MenuCommand and do nothing when it was disabled.

The problem is that when a Command is clicked, the form's MenuBar is disposed. Is there any way to avoid that behaviour? (without modifying LWUIT's source code).

Regards, Alberto.

Shai Almog
Re: Disable command menu items
Posted: Oct 14, 2008 10:16 PM   in response to: alrocar
  Click to reply to this thread Reply

I assume you mean the dialog is disposed.
Use dialog.setAutoDispose(false);

The previous poster mistakenly thought this was a Swing forum.

> Thanks for your reply.
>
> I think it would be enough for my purposes to override the
> actionPerformed method of my custom MenuCommand and do nothing when
> it was disabled.
>
> The problem is that when a Command is clicked, the form's MenuBar
> is disposed. Is there any way to avoid that behaviour? (without
> modifyinf LWUIT's source code).
>
> Regars, Alberto.
> [Message sent by forum member 'alrocar' (alrocar)]
>
> http://forums.java.net/jive/thread.jspa?messageID=306740
>
> ---------------------------------------------------------------------
> 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]


alrocar

Posts: 22
Re: Disable command menu items
Posted: Oct 23, 2008 3:33 AM   in response to: Shai Almog
  Click to reply to this thread Reply

I didn't realized that exists showDialogMenu method inside the Form class, so I have implemented it and everything is OK.

Thanks for your answers!!

Alberto.




 XML java.net RSS