コード例 #1
0
ファイル: JDragTree.java プロジェクト: TheSeeker/Thaw
 private void initialize() {
   // install drag n drop support
   dragSource = DragSource.getDefaultDragSource();
   dgRecognizer =
       dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this);
   // don't act on right mouse button
   dgRecognizer.setSourceActions(
       dgRecognizer.getSourceActions() & ~InputEvent.BUTTON3_MASK & ~InputEvent.BUTTON2_MASK);
   new DropTarget(this, new CDropTargetListener());
 }
コード例 #2
0
ファイル: FileTree.java プロジェクト: kidaak/cnuphys
  /** convenience routine for setting up drag and drop */
  private void setupDnD() {

    // gesture recognizer establishes what action starts the dnd

    DragGestureRecognizer dgr =
        dragSource.createDefaultDragGestureRecognizer(
            this, // DragSource
            DnDConstants.ACTION_COPY, // specifies valid actions
            this // DragGestureListener
            );

    /*
     * Eliminates right mouse clicks as valid actions - useful especially if
     * you implement a JPopupMenu for the JTree
     */
    dgr.setSourceActions(dgr.getSourceActions() & ~InputEvent.BUTTON3_MASK);
  }