List of usage examples for java.awt.dnd DragSource isDragImageSupported
public static boolean isDragImageSupported()
From source file:TransferableScribblePane.java
public TransferableScribblePane() { setPreferredSize(new Dimension(450, 200)); // We need a default size setBorder(normalBorder); // and a border. lines = new ArrayList(); // Start with an empty list of lines // Register interest in mouse button and mouse motion events. enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); // Enable drag-and-drop by specifying a listener that will be // notified when a drag begins. dragGestureListener is defined later. DragSource dragSource = DragSource.getDefaultDragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); // Enable drops on this component by registering a listener to // be notified when something is dragged or dropped over us. this.setDropTarget(new DropTarget(this, dropTargetListener)); // Check whether the system allows us to drag an image of the line canDragImage = dragSource.isDragImageSupported(); }
From source file:VASSAL.build.module.GlobalOptions.java
public void addTo(Buildable parent) { instance = this; final GameModule gm = GameModule.getGameModule(); final Prefs prefs = gm.getPrefs(); // should this moudule use a combined main window? final BooleanConfigurer combConf = new BooleanConfigurer(SINGLE_WINDOW, Resources.getString("GlobalOptions.use_combined"), //$NON-NLS-1$ Boolean.TRUE);/*from ww w .j av a 2 s.c o m*/ prefs.addOption(combConf); useSingleWindow = !Boolean.FALSE.equals(combConf.getValue()); // the initial heap size for this module final IntConfigurer initHeapConf = new IntConfigurer(INITIAL_HEAP, Resources.getString("GlobalOptions.initial_heap"), //$NON-NLS-1$ Integer.valueOf(256)); prefs.addOption(initHeapConf); // the maximum heap size for this module final IntConfigurer maxHeapConf = new IntConfigurer(MAXIMUM_HEAP, Resources.getString("GlobalOptions.maximum_heap"), //$NON-NLS-1$ Integer.valueOf(512)); prefs.addOption(maxHeapConf); // Bug 10295: Sometimes, for unknown reasons, the native drag handler // fails to draw images properly on Windows. This lets the user select // the drag handler to use. if (SystemUtils.IS_OS_WINDOWS) { final BooleanConfigurer bug10295Conf = new BooleanConfigurer(BUG_10295, Resources.getString("GlobalOptions.bug10295"), Boolean.FALSE); if (Boolean.TRUE.equals(bug10295Conf.getValue()) && !(PieceMover.AbstractDragHandler .getTheDragHandler() instanceof PieceMover.DragHandlerNoImage)) { PieceMover.AbstractDragHandler.setTheDragHandler(new PieceMover.DragHandlerNoImage()); } bug10295Conf.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { PieceMover.AbstractDragHandler.setTheDragHandler( (Boolean.TRUE.equals(e.getNewValue()) || !DragSource.isDragImageSupported()) ? new PieceMover.DragHandlerNoImage() : new PieceMover.DragHandler()); } }); prefs.addOption(bug10295Conf); } validator = new SingleChildInstance(gm, getClass()); }