NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Conditionally disable a submenu

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
jenh
Posted via mailing list.





PostPosted: Sat Aug 16, 2008 11:13 pm    Post subject: Conditionally disable a submenu Reply with quote

I have a class that is derived from CallableSystemAction. I am overriding
getMenuPresenter to return a JMenu. The JMenu has multiple JMenuItem
objects added to it so that it appears as a submenu of the top-level File
menu.

I want to conditionally disable the JMenu item (optimally), or
alternatively, to conditionally disable all the submenu items. For all my
other menu items I am able to override isEnabled in the derived
CallableSystemAction class, but for the submenu action the isEnabled
function is no longer called (I have no idea why).

How do I go about conditionally disabling the JMenu submenu?
--
View this message in context: http://www.nabble.com/Conditionally-disable-a-submenu-tp19015968p19015968.html
Sent from the Netbeans - Open API mailing list archive at Nabble.com.
Back to top
Tonny Kohar
Posted via mailing list.





PostPosted: Wed Aug 20, 2008 2:40 am    Post subject: Conditionally disable a submenu Reply with quote

Hi,

On Sun, Aug 17, 2008 at 6:12 AM, jenh <higbie@beyond6-sigma.com> wrote:
Quote:

I have a class that is derived from CallableSystemAction. I am overriding
getMenuPresenter to return a JMenu. The JMenu has multiple JMenuItem
objects added to it so that it appears as a submenu of the top-level File
menu.

I want to conditionally disable the JMenu item (optimally), or
alternatively, to conditionally disable all the submenu items. For all my
other menu items I am able to override isEnabled in the derived
CallableSystemAction class, but for the submenu action the isEnabled
function is no longer called (I have no idea why).

How do I go about conditionally disabling the JMenu submenu?

I do not know why it is not working in your case.

Another way to enable/disable menu item is by calling
setEnabled(boolean) rather than override the isEnabled(), because the
former method will fire appropriate property change listener, the
later is not. You can call the setEnabled(boolean) during
LookupListenerResultChanged or other event that appropriate for your
case.

Cheers
Tonny Kohar
--
Citra FX Photo Effects
imagine, design, create ...
http://www.kiyut.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo