Top Description Fields Constructors Methods
com.sun.jna.examples.dnd

public Class GhostedDragImage

extends Object
Class Inheritance
Imports
java.awt.Component, .Dimension, .Graphics, .GraphicsConfiguration, .Point, .Rectangle, .Window, java.awt.dnd.DragSource, java.awt.event.ActionEvent, .ActionListener, java.awt.geom.Area, javax.swing.Icon, .JOptionPane, .SwingUtilities, .Timer, com.sun.jna.examples.WindowUtils

Provide a ghosted drag image for use during drags where DragSource#isDragImageSupported returns false.

Its location in screen coordinates may be changed via move.

When the image is no longer needed, invoke dispose, which hides the graphic immediately, or returnToOrigin, which moves the image to its original location and then disposes it.

Field Summary

Modifier and TypeField and Description
private static final float
private Window
private Point
private static final int

Constructor Summary

AccessConstructor and Description
public
GhostedDragImage(Component dragSource, final Icon
image to be drawn
icon
,
Point
initial screen location of the image
initialScreenLoc
,
final Point cursorOffset)

Create a ghosted drag image, using the given icon.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Make all ghosted images go away.

public void
move(Point
Where to draw the image, in screen coordinates
screenLocation
)

Move the ghosted image to the requested location.

public void
returnToOrigin()

Animate the ghosted image returning to its origin.

public void
setAlpha(float alpha)

Set the transparency of the ghosted image.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_ALPHAback to summary
private static final float DEFAULT_ALPHA
dragImageback to summary
private Window dragImage
originback to summary
private Point origin
SLIDE_INTERVALback to summary
private static final int SLIDE_INTERVAL

Constructor Detail

GhostedDragImageback to summary
public GhostedDragImage(Component dragSource, final Icon icon, Point initialScreenLoc, final Point cursorOffset)

Create a ghosted drag image, using the given icon.

Parameters
icon:Icon

image to be drawn

initialScreenLoc:Point

initial screen location of the image

Method Detail

disposeback to summary
public void dispose()

Make all ghosted images go away.

moveback to summary
public void move(Point screenLocation)

Move the ghosted image to the requested location.

Parameters
screenLocation:Point

Where to draw the image, in screen coordinates

returnToOriginback to summary
public void returnToOrigin()

Animate the ghosted image returning to its origin.

setAlphaback to summary
public void setAlpha(float alpha)

Set the transparency of the ghosted image.