/** 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
}
}
IndexedCustomizer.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录