java.lang.Object
furbelow.AbstractComponentDecorator
furbelow.GhostedDragImage
Provide a ghosted drag image which will appear on any instances
of
RootPaneContainer in the current VM. Its location in
screen coordinates may be set via move(java.awt.Point).
When the image is no longer needed, invoke dispose(), which
hides the graphic immediately, or returnToOrigin(), which
moves the image to its original location prior to invoking
dispose().
-
Nested Class Summary
Nested classes/interfaces inherited from class furbelow.AbstractComponentDecorator
AbstractComponentDecorator.Painter -
Field Summary
Fields inherited from class furbelow.AbstractComponentDecorator
DEFAULT_BOUNDS, TOP -
Constructor Summary
ConstructorsModifierConstructorDescriptionGhostedDragImage(JComponent dragSource, Point screenLocation, Icon icon, Point imageOffset) Create a ghosted drag image, using the given icon.protectedGhostedDragImage(JComponent dragSource, JLayeredPane root, Point screenLocation, Icon icon, Point imageOffset, boolean trackFrames) Create a ghosted drag image. -
Method Summary
Modifier and TypeMethodDescriptionprotected RectangleclipDecorationBounds(Rectangle decorated) Adjust the bounds of the painting component to allow some buffer to avoid cursor flicker when moving.voiddispose()Make all ghosted images go away.voidMove the ghosted image to the requested location.voidPaint the supplied image with transparency.voidAnimate the ghosted image returning to its origin.voidsetAlpha(float alpha) Set the transparency of the ghosted image.voidEnsure the decorator cursor matches the drag cursor, or we get cursor flicker when autoscrolling.Methods inherited from class furbelow.AbstractComponentDecorator
attach, getComponent, getDecorationBounds, getPainter, getToolTipText, getToolTipText, isVisible, repaint, setDecorationBounds, setDecorationBounds, setPainterBounds, setToolTipText, setVisible, synch, toString
-
Constructor Details
-
GhostedDragImage
Create a ghosted drag image, using the given icon.- Parameters:
dragSource- source of the dragscreenLocation- screen location where the drag startedicon- image to be drawnimageOffset- offset of the image from the cursor
-
GhostedDragImage
protected GhostedDragImage(JComponent dragSource, JLayeredPane root, Point screenLocation, Icon icon, Point imageOffset, boolean trackFrames) Create a ghosted drag image.- Parameters:
dragSource- source of the dragroot- layered pane on which ghosted image is drawnscreenLocation- initial location of image, in screen coordinatesicon- icon to use for the ghost imageimageOffset- offset of the image within the drag sourcetrackFrames- if true, creates additional ghosts for all extant frames which contain aJLayeredPanewhere the image can be painted.
-
-
Method Details
-
setAlpha
public void setAlpha(float alpha) Set the transparency of the ghosted image. -
setCursor
Ensure the decorator cursor matches the drag cursor, or we get cursor flicker when autoscrolling.- Overrides:
setCursorin classAbstractComponentDecorator
-
dispose
public void dispose()Make all ghosted images go away.- Overrides:
disposein classAbstractComponentDecorator
-
clipDecorationBounds
Adjust the bounds of the painting component to allow some buffer to avoid cursor flicker when moving.- Overrides:
clipDecorationBoundsin classAbstractComponentDecorator
-
move
Move the ghosted image to the requested location.- Parameters:
screen- Where to draw the image, in screen coordinates
-
paint
Paint the supplied image with transparency.- Specified by:
paintin classAbstractComponentDecorator
-
returnToOrigin
public void returnToOrigin()Animate the ghosted image returning to its origin.
-