bibliothek.gui.dock.dockable
Class ScreencaptureMovingImageFactory

java.lang.Object
  extended by bibliothek.gui.dock.dockable.ScreencaptureMovingImageFactory
All Implemented Interfaces:
DockableMovingImageFactory
Direct Known Subclasses:
AncestorMovingImageFactory

public class ScreencaptureMovingImageFactory
extends Object
implements DockableMovingImageFactory

A factory that makes a snapshot of the Dockable which will be represented by its MovingImage.

Author:
Benjamin Sigg

Constructor Summary
ScreencaptureMovingImageFactory(Dimension max)
          Creates a new factory.
ScreencaptureMovingImageFactory(Dimension max, float alpha)
          Creates a new factory.
 
Method Summary
 MovingImage create(DockController controller, Dockable dockable)
          Gets an image which will be shown underneath the cursor.
 MovingImage create(DockController controller, DockTitle snatched)
          Gets an image which will be shown underneath the cursor.
 BufferedImage createImageFrom(DockController controller, Component c)
          This method creates a new image that contains the contents of c.
 BufferedImage createImageFrom(DockController controller, Dockable dockable)
          This method creates a new image that contains the contents of dockable.
 float getAlpha()
          Gets the transparency.
 void setAlpha(float alpha)
          Set the transparency of this image, where 0 means completely transparent and 1 means completely opaque
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreencaptureMovingImageFactory

public ScreencaptureMovingImageFactory(Dimension max)
Creates a new factory.

Parameters:
max - the maximal size of the images created by this factory, or null for not having a maximum size

ScreencaptureMovingImageFactory

public ScreencaptureMovingImageFactory(Dimension max,
                                       float alpha)
Creates a new factory.

Parameters:
max - the maximal size of the images created by this factory, or null for not having a maximum size
alpha - the transparency of this image, where 0 means completely transparent and 1 means completely opaque
Method Detail

setAlpha

public void setAlpha(float alpha)
Set the transparency of this image, where 0 means completely transparent and 1 means completely opaque

Parameters:
alpha - the strength of the image

getAlpha

public float getAlpha()
Gets the transparency.

Returns:
the transparency, a value between 0 and 1

create

public MovingImage create(DockController controller,
                          DockTitle snatched)
Description copied from interface: DockableMovingImageFactory
Gets an image which will be shown underneath the cursor. Assumes that the user clicked on the title snatched.

Specified by:
create in interface DockableMovingImageFactory
Parameters:
controller - The controller which will be responsible for the title
snatched - The title which is grabbed by the user
Returns:
the image under the cursor, can be null

create

public MovingImage create(DockController controller,
                          Dockable dockable)
Description copied from interface: DockableMovingImageFactory
Gets an image which will be shown underneath the cursor. Assumes that the user clicked on dockable.

Specified by:
create in interface DockableMovingImageFactory
Parameters:
controller - The controller which will be responsible for the title
dockable - The Dockable which is snatched
Returns:
the image under the cursor, can be null

createImageFrom

public BufferedImage createImageFrom(DockController controller,
                                     Dockable dockable)
This method creates a new image that contains the contents of dockable.

Parameters:
controller - the controller for which the image is made
dockable - the element whose image should be taken
Returns:
an image of dockable which is not larger than the maximum Dimension that was given to this factory in the constructor.
See Also:
AWTComponentCaptureStrategy

createImageFrom

public BufferedImage createImageFrom(DockController controller,
                                     Component c)
This method creates a new image that contains the contents of c.

Parameters:
controller - the controller for which the image is made
c - the Component whose image should be taken
Returns:
an image of c which is not larger than the maximum Dimension that was given to this factory in the constructor.
See Also:
AWTComponentCaptureStrategy