当前位置: 首页>>代码示例>>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;未经允许,请勿转载。