Quantcast

enable/disable menubar during runtime

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

enable/disable menubar during runtime

ronyh
Hi Everyone,
can anyone tell me how to enable/disable menubar during runtime ?
 
Thanks in advance
Rony


Looking for last minute shopping deals? Find them fast with Yahoo! Search.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable/disable menubar during runtime

Sarjay CS
I AFAIK there is no way to enable/disable entire the menu bar, instead u can enable/disable the entire menu bar items.

Try something as below :-

interface IAction {

     public void setEnabled(boolean isEnabled);
}

Let you action class extends this interface, for exmple

public class MyAction  extends CallableSystemAction implements IAction {
    // No need to implement the setEnabled(boolean isEnabled);, as it a method of the class CallableSystemAction.
}

Invoking the setEnabled(boolean isEnabled) using Lookup as below

Lookup lookup = Lookup.getDefault();
Lookup.Result result = (Result) lookup.lookup(new Lookup.Template(IAction.class));
for (Iterator it = result.allInstances().iterator(); it.hasNext();) {
    IAction action = (IAction) it.next();
    // true for enabling, false for disabling
    action.setEnabled(..);
}

This is the best solution which i was able to do.

Cheer's
Sarjay

On Thu, Mar 13, 2008 at 11:15 AM, Roni Herdianto <[hidden email]> wrote:
Hi Everyone,
can anyone tell me how to enable/disable menubar during runtime ?
 
Thanks in advance
Rony


Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: enable/disable menubar during runtime

David Strupl
Hello,

there is a possibility tu supply custom menu bar and status bar. Please check
the following:

http://bits.netbeans.org/dev/javadoc/org-openide-windows/overview-summary.html
Find on the page:
"netbeans.winsys.menu_bar.path"
"netbeans.winsys.status_line.path"

+ the rest of the properties in the section ;-)

Best regards,

David

Sarjay CS napsal(a):

> *I AFAIK there is no way to enable/disable entire the menu bar, instead u
> can enable/disable the entire menu bar items*.
>
> Try something as below :-
>
> interface IAction {
>
>      public void setEnabled(boolean isEnabled);
> }
>
> Let you action class extends this interface, for exmple
>
> public class MyAction  extends CallableSystemAction implements IAction {
>     // No need to implement the setEnabled(boolean isEnabled);, as it a
> method of the class CallableSystemAction.
> }
>
> Invoking the setEnabled(boolean isEnabled) using Lookup as below
>
> Lookup lookup = Lookup.getDefault();
> Lookup.Result result = (Result) lookup.lookup(new Lookup.Template(
> IAction.class));
> for (Iterator it = result.allInstances().iterator(); it.hasNext();) {
>     IAction action = (IAction) it.next();
>     // true for enabling, false for disabling
>     action.setEnabled(..);
> }
>
> This is the best solution which i was able to do.
>
> Cheer's
> Sarjay
>
> On Thu, Mar 13, 2008 at 11:15 AM, Roni Herdianto <[hidden email]>
> wrote:
>
>> Hi Everyone,
>> can anyone tell me how to enable/disable menubar during runtime ?
>>
>> Thanks in advance
>> Rony
>>
>> ------------------------------
>> Looking for last minute shopping deals? Find them fast with Yahoo! Search.<http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
>>
>

--
David Strupl
http://dstrupl.blogspot.com
Loading...