本文整理汇总了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;
}
}
}
}
示例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;
}
}
}
}
}
示例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
}
}
示例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));
}
}
示例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");
}
示例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");
}
示例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");
}
示例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));
}
}
}
}
}