本文整理匯總了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));
}
}
}
}
}