Java Code Examples for java.awt.dnd.DragSourceContext#setCursor()
The following examples show how to use
java.awt.dnd.DragSourceContext#setCursor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DnDSupport.java From netbeans with Apache License 2.0 | 5 votes |
public void dragMouseMoved(DragSourceDragEvent e) { Point location = WindowDnDManager.getLocationWorkaround(e); DragSourceContext context = e.getDragSourceContext(); if( isButtonDrag ) { int action = e.getDropAction(); if ((action & DnDConstants.ACTION_MOVE) != 0) { context.setCursor( dragMoveCursor ); } else { if( isInToolbarPanel( location ) ) { context.setCursor( dragNoDropCursor ); } else { context.setCursor( dragRemoveCursor ); } } } else if( isToolbarDrag && null != dragWindow ) { Point p = new Point( location ); p.x -= startingPoint.x; p.y -= startingPoint.y; dragWindow.setLocation(p); context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) ); ToolbarRow row = config.getToolbarRowAt( location ); if( null == row && (sourceRow.countVisibleToolbars() > 1 || !config.isLastRow(sourceRow)) ) { row = config.maybeAddEmptyRow( location ); } ToolbarRow oldRow = currentRow; currentRow = row; if( null != oldRow && oldRow != currentRow ) { oldRow.hideDropFeedback(); config.repaint(); } if( null != currentRow ) currentRow.showDropFeedback( sourceContainer, location, dragImage ); if( !config.isLastRow(currentRow) ) config.maybeRemoveLastRow(); } }
Example 2
Source File: KeyStoreEntryDragGestureListener.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
/** * Drag target entered. * * @param evt * Drag event */ @Override public void dragEnter(DragSourceDragEvent evt) { // Show drag cursor DragSourceContext ctx = evt.getDragSourceContext(); ctx.setCursor(cursor); }
Example 3
Source File: KeyStoreEntryDragGestureListener.java From keystore-explorer with GNU General Public License v3.0 | 2 votes |
/** * Drag target exited. * * @param evt * Drag event */ public void dragExit(DragSourceDragEvent evt) { // Show no drop cursor DragSourceContext ctx = evt.getDragSourceContext(); ctx.setCursor(DragSource.DefaultCopyNoDrop); }