478 }
479
480 /**
481 * This method returns the
482 * <code>FlavorMap</code> for this <code>DragSource</code>.
483 * <P>
484 * @return the <code>FlavorMap</code> for this <code>DragSource</code>
485 */
486
487 public FlavorMap getFlavorMap() { return flavorMap; }
488
489 /**
490 * Creates a new <code>DragGestureRecognizer</code>
491 * that implements the specified
492 * abstract subclass of
493 * <code>DragGestureRecognizer</code>, and
494 * sets the specified <code>Component</code>
495 * and <code>DragGestureListener</code> on
496 * the newly created object.
497 * <P>
498 * @param recognizerAbstractClass the requested abstract type
499 * @param actions the permitted source drag actions
500 * @param c the <code>Component</code> target
501 * @param dgl the <code>DragGestureListener</code> to notify
502 * <P>
503 * @return the new <code>DragGestureRecognizer</code> or <code>null</code>
504 * if the <code>Toolkit.createDragGestureRecognizer</code> method
505 * has no implementation available for
506 * the requested <code>DragGestureRecognizer</code>
507 * subclass and returns <code>null</code>
508 */
509
510 public <T extends DragGestureRecognizer> T
511 createDragGestureRecognizer(Class<T> recognizerAbstractClass,
512 Component c, int actions,
513 DragGestureListener dgl)
514 {
515 return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizerAbstractClass, this, c, actions, dgl);
516 }
517
652 * registered with this <code>DragSource</code>.
653 *
654 * @return all of this <code>DragSource</code>'s
655 * <code>DragSourceMotionListener</code>s or an empty array if no
656 * such listeners are currently registered
657 *
658 * @see #addDragSourceMotionListener
659 * @see #removeDragSourceMotionListener
660 * @since 1.4
661 */
662 public DragSourceMotionListener[] getDragSourceMotionListeners() {
663 return getListeners(DragSourceMotionListener.class);
664 }
665
666 /**
667 * Gets all the objects currently registered as
668 * <code><em>Foo</em>Listener</code>s upon this <code>DragSource</code>.
669 * <code><em>Foo</em>Listener</code>s are registered using the
670 * <code>add<em>Foo</em>Listener</code> method.
671 *
672 * @param listenerType the type of listeners requested; this parameter
673 * should specify an interface that descends from
674 * <code>java.util.EventListener</code>
675 * @return an array of all objects registered as
676 * <code><em>Foo</em>Listener</code>s on this
677 * <code>DragSource</code>, or an empty array if no such listeners
678 * have been added
679 * @exception ClassCastException if <code>listenerType</code>
680 * doesn't specify a class or interface that implements
681 * <code>java.util.EventListener</code>
682 *
683 * @see #getDragSourceListeners
684 * @see #getDragSourceMotionListeners
685 * @since 1.4
686 */
687 public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
688 EventListener l = null;
689 if (listenerType == DragSourceListener.class) {
690 l = listener;
691 } else if (listenerType == DragSourceMotionListener.class) {
|
478 }
479
480 /**
481 * This method returns the
482 * <code>FlavorMap</code> for this <code>DragSource</code>.
483 * <P>
484 * @return the <code>FlavorMap</code> for this <code>DragSource</code>
485 */
486
487 public FlavorMap getFlavorMap() { return flavorMap; }
488
489 /**
490 * Creates a new <code>DragGestureRecognizer</code>
491 * that implements the specified
492 * abstract subclass of
493 * <code>DragGestureRecognizer</code>, and
494 * sets the specified <code>Component</code>
495 * and <code>DragGestureListener</code> on
496 * the newly created object.
497 * <P>
498 * @param <T> the type of {@code DragGestureRecognizer} to create
499 * @param recognizerAbstractClass the requested abstract type
500 * @param actions the permitted source drag actions
501 * @param c the <code>Component</code> target
502 * @param dgl the <code>DragGestureListener</code> to notify
503 * <P>
504 * @return the new <code>DragGestureRecognizer</code> or <code>null</code>
505 * if the <code>Toolkit.createDragGestureRecognizer</code> method
506 * has no implementation available for
507 * the requested <code>DragGestureRecognizer</code>
508 * subclass and returns <code>null</code>
509 */
510
511 public <T extends DragGestureRecognizer> T
512 createDragGestureRecognizer(Class<T> recognizerAbstractClass,
513 Component c, int actions,
514 DragGestureListener dgl)
515 {
516 return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizerAbstractClass, this, c, actions, dgl);
517 }
518
653 * registered with this <code>DragSource</code>.
654 *
655 * @return all of this <code>DragSource</code>'s
656 * <code>DragSourceMotionListener</code>s or an empty array if no
657 * such listeners are currently registered
658 *
659 * @see #addDragSourceMotionListener
660 * @see #removeDragSourceMotionListener
661 * @since 1.4
662 */
663 public DragSourceMotionListener[] getDragSourceMotionListeners() {
664 return getListeners(DragSourceMotionListener.class);
665 }
666
667 /**
668 * Gets all the objects currently registered as
669 * <code><em>Foo</em>Listener</code>s upon this <code>DragSource</code>.
670 * <code><em>Foo</em>Listener</code>s are registered using the
671 * <code>add<em>Foo</em>Listener</code> method.
672 *
673 * @param <T> the type of listener objects
674 * @param listenerType the type of listeners requested; this parameter
675 * should specify an interface that descends from
676 * <code>java.util.EventListener</code>
677 * @return an array of all objects registered as
678 * <code><em>Foo</em>Listener</code>s on this
679 * <code>DragSource</code>, or an empty array if no such listeners
680 * have been added
681 * @exception ClassCastException if <code>listenerType</code>
682 * doesn't specify a class or interface that implements
683 * <code>java.util.EventListener</code>
684 *
685 * @see #getDragSourceListeners
686 * @see #getDragSourceMotionListeners
687 * @since 1.4
688 */
689 public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
690 EventListener l = null;
691 if (listenerType == DragSourceListener.class) {
692 l = listener;
693 } else if (listenerType == DragSourceMotionListener.class) {
|