|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.gui.DragSprite
Icon dragged across DragFrame.
Details: A DragSprite is an image that is dragged across the surface of a DragFrame or DragPanel. It encapsulates the image data, the image's grip point, and methods for rendering the image.
DragFrame
,
DragPanel
Constructor Summary | |
DragSprite(javax.swing.Icon icon)
Initializes using the given Icon and a centered grip point. |
|
DragSprite(javax.swing.Icon icon,
java.awt.Point grip)
Initializes using the given Icon and grip point. |
Method Summary | |
java.awt.Rectangle |
getFootprint(int x,
int y)
Computes rectangular region affected by calling paintIcon. |
java.awt.Rectangle |
getFootprint(java.awt.Point p)
Computes rectangular region affected by calling paintIcon. |
int |
getIconHeight()
Returns this icon's height. |
int |
getIconWidth()
Returns this icon's width. |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the icon at the given point. |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
java.awt.Point p)
Paints the icon at the given point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DragSprite(javax.swing.Icon icon, java.awt.Point grip)
Details: This constructor intializes a new DragSprite to display the given Icon offset by the given grip
position. Future calls to paintIcon will cause the icon to be displayed in a translated coordinate system, according to the grip position.
When creating a DragSprite in response to the beginning of a drag session, the grip position should be set to the mouse coordinates of the beginning of the drag, relative to the upper-left pixel of the icon at the time the drag was initiated.
the
- Icon to displaythe
- grip point of this spritepublic DragSprite(javax.swing.Icon icon)
Details: This constructor intializes a new DragSprite to display the given Icon offset by a grip point at its center. Future calls to paintIcon will cause the icon to be displayed in a translated coordinate system, according to the grip position.
When creating a DragSprite in response to the beginning of a drag session, the grip position should be set to the mouse coordinates of the beginning of the drag, relative to the upper-left pixel of the icon at the time the drag was initiated.
the
- Icon to displaythe
- grip point of this spriteMethod Detail |
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
Details: paintIcon renders the icon at the given point, translated by the icon's grip point.
paintIcon
in interface javax.swing.Icon
g
- the graphics contextc
- the Component to which g drawsx
- the x draw coordinatey
- the y draw coordinatepublic void paintIcon(java.awt.Component c, java.awt.Graphics g, java.awt.Point p)
Details: paintIcon renders the icon at the given point, translated by the icon's grip point.
g
- the graphics contextc
- the Component to which g drawsp
- the draw coordinatepublic int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public java.awt.Rectangle getFootprint(int x, int y)
Details: getFootprint determines the rectangular region that would be potentially affected if the icon were drawn at the given point. The rectangular region returned is the bounding rectangle of the icon, translated by the grip point.
When moving the icon from one point to another, the old icon region and the new icon region should be invalidated. getFootprint facilitates this step.
x
- the x draw coordinatey
- the y draw coordinatepublic java.awt.Rectangle getFootprint(java.awt.Point p)
Details: getFootprint determines the rectangular region that would be potentially affected if the icon were drawn at the given point. The rectangular region returned is the bounding rectangle of the icon, translated by the grip point.
When moving the icon from one point to another, the old icon region and the new icon region should be invalidated. getFootprint facilitates this step.
p
- the draw coordinate
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |