647 * Returns an array of all the objects currently registered 648 * as <code><em>Foo</em>Listener</code>s 649 * upon this model. 650 * <code><em>Foo</em>Listener</code>s are registered using the 651 * <code>add<em>Foo</em>Listener</code> method. 652 * 653 * <p> 654 * 655 * You can specify the <code>listenerType</code> argument 656 * with a class literal, 657 * such as 658 * <code><em>Foo</em>Listener.class</code>. 659 * For example, you can query a 660 * <code>DefaultTreeSelectionModel</code> <code>m</code> 661 * for its tree selection listeners with the following code: 662 * 663 * <pre>TreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));</pre> 664 * 665 * If no such listeners exist, this method returns an empty array. 666 * 667 * @param listenerType the type of listeners requested; this parameter 668 * should specify an interface that descends from 669 * <code>java.util.EventListener</code> 670 * @return an array of all objects registered as 671 * <code><em>Foo</em>Listener</code>s on this component, 672 * or an empty array if no such 673 * listeners have been added 674 * @exception ClassCastException if <code>listenerType</code> 675 * doesn't specify a class or interface that implements 676 * <code>java.util.EventListener</code> 677 * 678 * @see #getTreeSelectionListeners 679 * @see #getPropertyChangeListeners 680 * 681 * @since 1.3 682 */ 683 public <T extends EventListener> T[] getListeners(Class<T> listenerType) { 684 return listenerList.getListeners(listenerType); 685 } 686 687 /** 688 * Returns the selection in terms of rows. There is not 689 * necessarily a one-to-one mapping between the {@code TreePath}s | 647 * Returns an array of all the objects currently registered 648 * as <code><em>Foo</em>Listener</code>s 649 * upon this model. 650 * <code><em>Foo</em>Listener</code>s are registered using the 651 * <code>add<em>Foo</em>Listener</code> method. 652 * 653 * <p> 654 * 655 * You can specify the <code>listenerType</code> argument 656 * with a class literal, 657 * such as 658 * <code><em>Foo</em>Listener.class</code>. 659 * For example, you can query a 660 * <code>DefaultTreeSelectionModel</code> <code>m</code> 661 * for its tree selection listeners with the following code: 662 * 663 * <pre>TreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));</pre> 664 * 665 * If no such listeners exist, this method returns an empty array. 666 * 667 * @param <T> the listener type 668 * @param listenerType the type of listeners requested 669 * @return an array of all objects registered as 670 * <code><em>Foo</em>Listener</code>s on this component, 671 * or an empty array if no such 672 * listeners have been added 673 * @exception ClassCastException if <code>listenerType</code> 674 * doesn't specify a class or interface that implements 675 * <code>java.util.EventListener</code> 676 * 677 * @see #getTreeSelectionListeners 678 * @see #getPropertyChangeListeners 679 * 680 * @since 1.3 681 */ 682 public <T extends EventListener> T[] getListeners(Class<T> listenerType) { 683 return listenerList.getListeners(listenerType); 684 } 685 686 /** 687 * Returns the selection in terms of rows. There is not 688 * necessarily a one-to-one mapping between the {@code TreePath}s |