當前位置: 首頁>>代碼示例>>Java>>正文


Java DragGestureEvent.getDragAction方法代碼示例

本文整理匯總了Java中java.awt.dnd.DragGestureEvent.getDragAction方法的典型用法代碼示例。如果您正苦於以下問題:Java DragGestureEvent.getDragAction方法的具體用法?Java DragGestureEvent.getDragAction怎麽用?Java DragGestureEvent.getDragAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.dnd.DragGestureEvent的用法示例。


在下文中一共展示了DragGestureEvent.getDragAction方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
	if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
		Point p = dge.getDragOrigin();
		
		for (int i = 0; i < constraints.size(); i++) {
			Component cmp = operationPanel.getComponent(i);
			if (cmp.getBounds().contains(p)) {
				rootFrame.glassPane.setImage(PivotSlice.getScreenShot(cmp));
				dge.startDrag(DragSource.DefaultCopyDrop, new Constraint.TransferableConstraint(constraints.get(i)));
				
				rootFrame.logger.logAction("historypanel-drag attribute");
				break;
			}
		}
	}
}
 
開發者ID:jeffjianzhao,項目名稱:PivotSlice,代碼行數:18,代碼來源:HistoryPanel.java

示例2: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent e) {
	dragRecogonized = true;
	if (e.getDragAction() == DnDConstants.ACTION_COPY) {
		if (timer.isRunning())
			timer.stop();
		
		String text = searchBox.getText().toLowerCase();
		if (text.startsWith("/")) {
			for (int i = 0; i < facetSearchTags.length; i++) {
				if (text.startsWith(facetSearchTags[i])) {
					Constraint.ConstraintData cdata = generateConstraintData(i, text);
					if (cdata == null)
						return;
					
					rootFrame.glassPane.setImage(PivotSlice.getScreenShot(searchBox));
					e.startDrag(DragSource.DefaultCopyDrop, new Constraint.TransferableConstraint(cdata));
					
					rootFrame.logger.logAction("searchpanel-drag attribute");
					break;
				}
			}
		}
	}
}
 
開發者ID:jeffjianzhao,項目名稱:PivotSlice,代碼行數:26,代碼來源:SearchPanel.java

示例3: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
/** Initiating the drag */
public void dragGestureRecognized(DragGestureEvent dge) {
    // check allowed actions
    if ((dge.getDragAction() & DnDConstants.ACTION_MOVE) == 0) {
        return;
    }

    // prepare transferable and start the drag
    int index = comp.locationToIndex(dge.getDragOrigin());

    // no index, then no dragging...
    if (index < 0) {
        return;
    }

    //      System.out.println("Starting drag..."); // NOI18N
    // create our flavor for transferring the index
    myFlavor = new DataFlavor(
            String.class, NbBundle.getBundle(IndexedCustomizer.class).getString("IndexedFlavor")
        );

    try {
        dge.startDrag(DragSource.DefaultMoveDrop, new IndexTransferable(myFlavor, index), this);

        // remember the gesture
        this.dge = dge;
    } catch (InvalidDnDOperationException exc) {
        Logger.getLogger(IndexedCustomizer.class.getName()).log(Level.WARNING, null, exc);

        // PENDING notify user - cannot start the drag
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:IndexedCustomizer.java

示例4: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
	Cursor cursor = null;
	if(dge.getComponent() instanceof RepositoryViewer){
		RepositoryViewer rv = (RepositoryViewer) dge.getComponent();
		KernelRepositoryEntry kre = (KernelRepositoryEntry) rv.getSelectedValue();
		
		if(dge.getDragAction()==DnDConstants.ACTION_COPY){
			cursor = DragSource.DefaultCopyDrop;
		}
		
		dge.startDrag(cursor, new TransferableKernelRepositoryEntry(kre));
	}
}
 
開發者ID:roscisz,項目名稱:KernelHive,代碼行數:15,代碼來源:RepositoryViewerDragGestureListener.java

示例5: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
	rootFrame.glassPane.setImage(PivotSlice.getScreenShot(this));
	if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
		dge.startDrag(DragSource.DefaultCopyDrop, new TransferableConstraint(constrData));
	}
	else {
		dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(constrData));
		setConstraintData(new ConstraintData(constrData.facetID));
		childUpdated();
	}
	
	rootFrame.logger.logAction("filter-drag constraint");
}
 
開發者ID:jeffjianzhao,項目名稱:PivotSlice,代碼行數:15,代碼來源:Constraint.java

示例6: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
	rootFrame.glassPane.setImage(PivotSlice.getScreenShot(this));
	Point p = dge.getDragOrigin();
	Constraint.ConstraintData cdata = parentConstr.getConstraintData();
	
	if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
		if (attributeLabel == this) 
			dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID, 
					cdata.valueIDs.get(showIndex)));	
		else  if (fromLabel == this) 
			dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID,
					cdata.fromValue, cdata.fromValue));
		else if (toLabel == this) 
			dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID,
					cdata.toValue, cdata.toValue));	
	}
	else {
		if (attributeLabel == this) {
			dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID, 
					cdata.valueIDs.get(showIndex)));
			removePressed();
		}
		else if (cdata.fromValue != cdata.toValue) {
			if (fromLabel == this) {	
				dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID,
						cdata.fromValue, cdata.fromValue));
				nextPressed(this);	
			}
			else if (toLabel == this) {
				dge.startDrag(DragSource.DefaultMoveDrop, new TransferableConstraint(cdata.facetID,
						cdata.toValue, cdata.toValue));
				prevPressed(this);
			}
		}
	}
	
	rootFrame.logger.logAction("filter-drag attribute");
}
 
開發者ID:jeffjianzhao,項目名稱:PivotSlice,代碼行數:40,代碼來源:ConstraintContent.java

示例7: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
	if (parentBrowser.getNodesFilters().indexOf(this) == 0)
		return;
	rootFrame.glassPane.setImage(PivotSlice.getScreenShot(this));
	if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
		dge.startDrag(DragSource.DefaultCopyDrop, new TransferableNodesFilter(this));	
	}
	else {
		dge.startDrag(DragSource.DefaultMoveDrop, new TransferableNodesFilter(this));
		parentBrowser.removeNodesFilter(this);
	}
	
	rootFrame.logger.logAction("filter-drag filter");
}
 
開發者ID:jeffjianzhao,項目名稱:PivotSlice,代碼行數:16,代碼來源:NodesFilter.java

示例8: dragGestureRecognized

import java.awt.dnd.DragGestureEvent; //導入方法依賴的package包/類
@Override
public void dragGestureRecognized(DragGestureEvent event) {

	TreePath path = tree.getSelectionPath();
	if (path != null) {

		// Dragged node is a DefaultMutableTreeNode
		if(path.getLastPathComponent() instanceof DefaultMutableTreeNode) {
			DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) path.getLastPathComponent();

			// This is an ObjectType node
			if(treeNode.getUserObject() instanceof ObjectType) {
				ObjectType type = (ObjectType) treeNode.getUserObject();
				Cursor cursor = null;

				if (event.getDragAction() == DnDConstants.ACTION_COPY) {
					cursor = DragSource.DefaultCopyDrop;
				}
				if (RenderManager.isGood()) {
					// The new renderer is initialized
					RenderManager.inst().startDragAndDrop(type);
					event.startDrag(cursor,new TransferableObjectType(type), RenderManager.inst());

				} else {
					event.startDrag(cursor,new TransferableObjectType(type));
				}
			}
		}
	}
}
 
開發者ID:jaamsim,項目名稱:jaamsim,代碼行數:31,代碼來源:EntityPallet.java


注:本文中的java.awt.dnd.DragGestureEvent.getDragAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。