/// <summary> /// Returns an array of all the objects currently registered /// as <code><em>Foo</em>Listener</code>s /// upon this <code>MenuItem</code>. /// <code><em>Foo</em>Listener</code>s are registered using the /// <code>add<em>Foo</em>Listener</code> method. /// /// <para> /// You can specify the <code>listenerType</code> argument /// with a class literal, such as /// <code><em>Foo</em>Listener.class</code>. /// For example, you can query a /// <code>MenuItem</code> <code>m</code> /// for its action listeners with the following code: /// /// <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre> /// /// If no such listeners exist, this method returns an empty array. /// /// </para> /// </summary> /// <param name="listenerType"> the type of listeners requested; this parameter /// should specify an interface that descends from /// <code>java.util.EventListener</code> </param> /// <returns> an array of all objects registered as /// <code><em>Foo</em>Listener</code>s on this menu item, /// or an empty array if no such /// listeners have been added </returns> /// <exception cref="ClassCastException"> if <code>listenerType</code> /// doesn't specify a class or interface that implements /// <code>java.util.EventListener</code> /// </exception> /// <seealso cref= #getActionListeners /// @since 1.3 </seealso> public virtual T[] getListeners <T>(Class listenerType) where T : java.util.EventListener { EventListener l = null; if (listenerType == typeof(ActionListener)) { l = ActionListener; } return(AWTEventMulticaster.GetListeners(l, listenerType)); }
/// <summary> /// Returns an array of all the objects currently registered /// as <code><em>Foo</em>Listener</code>s /// upon this <code>CheckboxMenuItem</code>. /// <code><em>Foo</em>Listener</code>s are registered using the /// <code>add<em>Foo</em>Listener</code> method. /// /// <para> /// You can specify the <code>listenerType</code> argument /// with a class literal, such as /// <code><em>Foo</em>Listener.class</code>. /// For example, you can query a /// <code>CheckboxMenuItem</code> <code>c</code> /// for its item listeners with the following code: /// /// <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre> /// /// If no such listeners exist, this method returns an empty array. /// /// </para> /// </summary> /// <param name="listenerType"> the type of listeners requested; this parameter /// should specify an interface that descends from /// <code>java.util.EventListener</code> </param> /// <returns> an array of all objects registered as /// <code><em>Foo</em>Listener</code>s on this checkbox menuitem, /// or an empty array if no such /// listeners have been added </returns> /// <exception cref="ClassCastException"> if <code>listenerType</code> /// doesn't specify a class or interface that implements /// <code>java.util.EventListener</code> /// </exception> /// <seealso cref= #getItemListeners /// @since 1.3 </seealso> public override T[] getListeners <T>(Class listenerType) where T : java.util.EventListener { EventListener l = null; if (listenerType == typeof(ItemListener)) { l = ItemListener; } else { return(base.GetListeners(listenerType)); } return(AWTEventMulticaster.GetListeners(l, listenerType)); }