JavaTM 2 Platform
Standard Ed. 5.0

java.awt.dnd
クラス DragGestureRecognizer

java.lang.Object
  上位を拡張 java.awt.dnd.DragGestureRecognizer
すべての実装されたインタフェース:
Serializable
直系の既知のサブクラス:
MouseDragGestureRecognizer

public abstract class DragGestureRecognizer
extends Object
implements Serializable

DragGestureRecognizer は、プラットフォーム依存のドラッグ開始ジェスチャーを識別するために、特定の Component に関連付けることができる、プラットフォーム依存のリスナーを指定するための抽象基底クラスです。

適切な DragGestureRecognizer のサブクラスは、特定の Component に関連付けられている DragSource、または createDragGestureRecognizer() メソッドを介して Toolkit オブジェクトから取得されます。

特定の Component に関連付けられると、DragGestureRecognizerComponent に送られる入力イベントを追跡するために、その Component に適切なリスナーインタフェースを登録します。

Component でイベントのシーケンスをドラッグ開始ジェスチャーとして識別すると、DragGestureRecognizer は gestureRecognized() メソッドを呼び出してそのユニキャスト DragGestureListener に通知します。

具象 DragGestureRecognizer インスタンスが、関連付けられている Component でドラッグ開始ジェスチャーを検出すると、DragGestureListener イベントのユニキャストイベントソースに登録されている DragGestureListenerDragGestureEvent をトリガします。この DragGestureListener は、関連付けられた DragSource に必要に応じてドラッグ&ドロップ操作の開始を促します。

関連項目:
DragGestureListener, DragGestureEvent, DragSource, 直列化された形式

フィールドの概要
protected  Component component
          DragGestureRecognizer に関連した Component です。
protected  DragGestureListener dragGestureListener
          DragGestureRecognizer に関連した DragGestureListener です。
protected  DragSource dragSource
          DragGestureRecognizer に関連した DragSource です。
protected  ArrayList<InputEvent> events
          ドラッグをトリガする「ジェスチャー」として DragGestureRecognizer が「認識される」ようにするイベントのリストです。
protected  int sourceActions
          ドラッグ&ドロップ操作で使用するアクションの形式を表す int です。
 
コンストラクタの概要
protected DragGestureRecognizer(DragSource ds)
          このドラッグ&ドロップ操作に使用する DragSource を指定して新しい DragGestureRecognizer を構築します。
protected DragGestureRecognizer(DragSource ds, Component c)
          このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component を指定して新しい DragGestureRecognizer を構築します。
protected DragGestureRecognizer(DragSource ds, Component c, int sa)
          このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component、このドラッグ&ドロップ操作をサポートするアクションを指定して新しい DragGestureRecognizer を構築します。
protected DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl)
          このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component、このドラッグ&ドロップ操作をサポートするアクション、および DragGestureListener を指定して新しい DragGestureRecognizer を構築して、ドラッグ開始ジェスチャーを検出したことを一度通知します。
 
メソッドの概要
 void addDragGestureListener(DragGestureListener dgl)
          新しい DragGestureListener を登録します。
protected  void appendEvent(InputEvent awtie)
          この Recognizer によって Component で登録されたリスナーは、この API を介して、ドラッグ&ドロップ開始ジェスチャーを構成する一連のイベントの一部として認識されるすべてのイベントを記録します。
protected  void fireDragGestureRecognized(int dragAction, Point p)
          ドラッグ&ドロップ開始ジェスチャーが発生したことを DragGestureListener に通知します。
 Component getComponent()
          このメソッドは、ドラッグ開始ジェスチャーを DragGestureRecognizer に「監視」される Component を返します。
 DragSource getDragSource()
          このメソッドは、この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource を返します。
 int getSourceActions()
          このメソッドは、このドラッグ&ドロップ操作がサポートするアクションの形式を表す int を返します。
 InputEvent getTriggerEvent()
          このメソッドは、ドラッグ&ドロップ操作を開始した一連のイベントの最初のイベントを返します。
protected abstract  void registerListeners()
          この DragGestureRecognizer のリスナーを Component に登録します。
 void removeDragGestureListener(DragGestureListener dgl)
          現在の DragGestureListener の登録を解除します。
 void resetRecognizer()
          Recognizer を取り消します。
 void setComponent(Component c)
          DragGestureRecognizer が関連付けられる Component を設定します。
 void setSourceActions(int actions)
          このメソッドはドラッグ&ドロップ操作に許可されているソースドラッグアクションを設定します。
protected abstract  void unregisterListeners()
          この DragGestureRecognizer のリスナーを Component から登録解除します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

dragSource

protected DragSource dragSource
DragGestureRecognizer に関連した DragSource です。


component

protected Component component
DragGestureRecognizer に関連した Component です。


dragGestureListener

protected transient DragGestureListener dragGestureListener
DragGestureRecognizer に関連した DragGestureListener です。


sourceActions

protected int sourceActions
ドラッグ&ドロップ操作で使用するアクションの形式を表す int です。


events

protected ArrayList<InputEvent> events
ドラッグをトリガする「ジェスチャー」として DragGestureRecognizer が「認識される」ようにするイベントのリストです。

コンストラクタの詳細

DragGestureRecognizer

protected DragGestureRecognizer(DragSource ds,
                                Component c,
                                int sa,
                                DragGestureListener dgl)
このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component、このドラッグ&ドロップ操作をサポートするアクション、および DragGestureListener を指定して新しい DragGestureRecognizer を構築して、ドラッグ開始ジェスチャーを検出したことを一度通知します。

パラメータ:
ds - この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource
c - この DragGestureRecognizer がドラッグ開始ジェスチャーを検出するためにイベントストリームを「監視」する Component。この値が null の場合、DragGestureRecognizer はどの Component にも関連付けられていない
sa - このドラッグ&ドロップ操作がサポートする DnDConstants のセット (論理和)
dgl - ドラッグジェスチャーが検出されたときに通知する DragGestureRecognizer

例外:
IllegalArgumentException - ds が null の場合

DragGestureRecognizer

protected DragGestureRecognizer(DragSource ds,
                                Component c,
                                int sa)
このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component、このドラッグ&ドロップ操作をサポートするアクションを指定して新しい DragGestureRecognizer を構築します。

パラメータ:
ds - この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource
c - この DragGestureRecognizer がドラッグ開始ジェスチャーを検出するためにイベントストリームを「監視」する Component。この値が null の場合、DragGestureRecognizer はどの Component にも関連付けられていない
sa - このドラッグ&ドロップ操作がサポートする DnDConstants のセット (論理和)

例外:
IllegalArgumentException - ds が null の場合

DragGestureRecognizer

protected DragGestureRecognizer(DragSource ds,
                                Component c)
このドラッグ&ドロップ操作に使用する DragSource、この DragGestureRecognizer がドラッグ開始ジェスチャーを「監視」できる Component を指定して新しい DragGestureRecognizer を構築します。

パラメータ:
ds - この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource
c - この DragGestureRecognizer がドラッグ開始ジェスチャーを検出するためにイベントストリームを「監視」する Component。この値が null の場合、DragGestureRecognizer はどの Component にも関連付けられていない

例外:
IllegalArgumentException - ds が null の場合

DragGestureRecognizer

protected DragGestureRecognizer(DragSource ds)
このドラッグ&ドロップ操作に使用する DragSource を指定して新しい DragGestureRecognizer を構築します。

パラメータ:
ds - この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource

例外:
IllegalArgumentException - ds が null の場合
メソッドの詳細

registerListeners

protected abstract void registerListeners()
この DragGestureRecognizer のリスナーを Component に登録します。 サブクラスはこのメソッドをオーバーライドする必要があります。


unregisterListeners

protected abstract void unregisterListeners()
この DragGestureRecognizer のリスナーを Component から登録解除します。 サブクラスはこのメソッドをオーバーライドする必要があります。


getDragSource

public DragSource getDragSource()
このメソッドは、この DragGestureRecognizer が、ドラッグ&ドロップ操作を処理するために使用する DragSource を返します。

戻り値:
DragSource

getComponent

public Component getComponent()
このメソッドは、ドラッグ開始ジェスチャーを DragGestureRecognizer に「監視」される Component を返します。

戻り値:
この DragGestureRecognizer が関連付けられている Component

setComponent

public void setComponent(Component c)
DragGestureRecognizer が関連付けられる Component を設定します。 registerListeners() および unregisterListeners() は、必要に応じて副作用として呼び出されます。

パラメータ:
c - Component または null

getSourceActions

public int getSourceActions()
このメソッドは、このドラッグ&ドロップ操作がサポートするアクションの形式を表す int を返します。

戻り値:
現在許可されているソースアクション

setSourceActions

public void setSourceActions(int actions)
このメソッドはドラッグ&ドロップ操作に許可されているソースドラッグアクションを設定します。

パラメータ:
actions - 許可されているソースドラッグアクション

getTriggerEvent

public InputEvent getTriggerEvent()
このメソッドは、ドラッグ&ドロップ操作を開始した一連のイベントの最初のイベントを返します。

戻り値:
ドラッグジェスチャーをトリガした初期イベント

resetRecognizer

public void resetRecognizer()
Recognizer を取り消します。現在ジェスチャーを認識している場合は無視されます。


addDragGestureListener

public void addDragGestureListener(DragGestureListener dgl)
                            throws TooManyListenersException
新しい DragGestureListener を登録します。

パラメータ:
dgl - この DragGestureRecognizer に同時に登録する DragGestureListener

例外:
TooManyListenersException - DragGestureListener がすでに追加されている場合

removeDragGestureListener

public void removeDragGestureListener(DragGestureListener dgl)
現在の DragGestureListener の登録を解除します。

パラメータ:
dgl - この DragGestureRecognizer から登録を解除する DragGestureListener

例外:
IllegalArgumentException - dgl が現在登録されている DragGestureListener ではない場合 (異なる場合)

fireDragGestureRecognized

protected void fireDragGestureRecognized(int dragAction,
                                         Point p)
ドラッグ&ドロップ開始ジェスチャーが発生したことを DragGestureListener に通知します。次に、Recognizer の状態を取り消します。

パラメータ:
dragAction - ユーザジェスチャーが最初に選択したアクション
p - ジェスチャーが発生したポイント (Component の座標)

appendEvent

protected void appendEvent(InputEvent awtie)
この Recognizer によって Component で登録されたリスナーは、この API を介して、ドラッグ&ドロップ開始ジェスチャーを構成する一連のイベントの一部として認識されるすべてのイベントを記録します。

このメソッドは DragGestureRecognizer 実装が InputEvent サブクラス (ドラッグ&ドロップ操作を構成する一連のイベントの一つ) を、この DragGestureRecognizer が内部的に維持しているイベント配列に追加するときに使用します。

パラメータ:
awtie - この DragGestureRecognizer の内部イベント配列に追加する InputEventnull は有効値ではなく無視される

JavaTM 2 Platform
Standard Ed. 5.0

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java 2 SDK SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。