|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectNGP.Graphics.Image
An image that knows how to draw itself on the screen.
| Constructor Summary | |
Image(DrawingPanel dp,
String file)
Create an image from a filename. |
|
Image(DrawingPanel dp,
URL url)
Create an image from a URL. |
|
| Method Summary | |
boolean |
contains(Point p)
See if this Image contains the Point |
void |
drag(MouseEvent e)
Override to do something useful. |
Image |
getAWTImage()
Get the AWT Image that we are using, not necessary for most users. |
Rectangle |
getBounds()
Get the rectangle that indicates the bounds of this Image |
Point |
getCenterLocation()
Return the Point that represents the center of the bounding rectangle of this shape. |
Dimension |
getDimension()
Get the dimensions of this Image |
DrawingPanel |
getDrawingPanel()
Get the DrawingPanel for this Image |
Point |
getLocation()
Get the location of this Image |
int |
getRotation()
Get the rotation for this Image |
void |
hide()
Hide the Image so it won't paint |
boolean |
intersects(Graphic g)
Determine whether the passed in Graphic intersects with
this Image. |
void |
mouseClicked(MouseEvent e)
Called when the Panel detects that the mouse was clicked. |
void |
mouseDragged(MouseEvent e)
Called when the Panel detects that the mouse was dragged. |
void |
mouseEntered(MouseEvent e)
Called when the Panel detects that the mouse entered. |
void |
mouseExited(MouseEvent e)
Called when the Panel detects that the mouse exited. |
void |
mouseMoved(MouseEvent e)
Called when the Panel detects that the mouse was moved. |
void |
mousePressed(MouseEvent e)
Called when the Panel detects that the mouse was pressed. |
void |
mouseReleased(MouseEvent e)
Called when the Panel detects that the mouse was released. |
void |
paint(Graphics2D g)
Normal users need not use this! |
void |
react()
Override to do something useful. |
void |
setCenterLocation(Point p)
Set the location of the Image so that its center point is at the specified location. |
void |
setDimension(Dimension d)
Set the dimensions of this Image |
void |
setDrawingPanel(DrawingPanel dp)
Set the DrawingPanel for this Image |
void |
setLocation(Point p)
Set the location of this Image |
void |
setRotation(int degrees)
Set the rotation for this Image |
protected void |
setup(DrawingPanel dp)
Normal users need not use this! |
void |
show()
Show the Image so it paints |
void |
unwrap()
Set this image so that it will does not necessarily display in its DrawingPanel |
void |
wrap()
Set this image so that it will always display in its DrawingPanel |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Image(DrawingPanel dp,
String file)
dp - the DrawingPanel for this imagefile - the filename to take this image form (gif or jpg)
public Image(DrawingPanel dp,
URL url)
dp - the DrawingPanel for this imageurl - the URL to take this image form (gif or jpg)createURL| Method Detail |
protected void setup(DrawingPanel dp)
Use the media tracker to load the image, then initialize everything else.
public void setDimension(Dimension d)
setDimension in interface Sizeabled - the new Dimension for this ImagegetDimensionpublic Dimension getDimension()
getDimension in interface SizeableDimension for this ImagesetDimensionpublic void setLocation(Point p)
setLocation in interface Locatablep - the new Point for this ImagegetLocationpublic void setCenterLocation(Point p)
p - the new Point for the center of this
Imagepublic Point getLocation()
getLocation in interface LocatablePoint for this ImagesetLocationpublic void hide()
hide in interface Graphicpublic void show()
show in interface Graphicpublic void setDrawingPanel(DrawingPanel dp)
setDrawingPanel in interface Graphicdp - the new DrawingPanel for the ImagegetDrawingPanelpublic DrawingPanel getDrawingPanel()
getDrawingPanel in interface GraphicDrawingPanel for the ImagesetDrawingPanelpublic Image getAWTImage()
public boolean contains(Point p)
contains in interface Graphicp - the Point to test
true if the Point is contained,
false otherwisepublic void setRotation(int degrees)
setRotation in interface Rotatabledegrees - the degrees (clockwise) that this should rotategetRotationpublic int getRotation()
getRotation in interface RotatablesetRotationpublic void paint(Graphics2D g)
Rotate the Graphics Context if necessary, the paint, then reset the rotation
paint in interface Graphicg - the Graphics2D to use when paintingpublic void wrap()
public void unwrap()
public Rectangle getBounds()
Image
getBounds in interface Graphicjava.awt.Rectangle that indicates our bounds.public Point getCenterLocation()
getCenterLocation in interface Graphicpublic boolean intersects(Graphic g)
Graphic intersects with
this Image.
intersects in interface Graphicg - the Graphic to test
true if they do intersect, false
otherwisegetBoundspublic void react()
react in interface Reactorpublic void drag(MouseEvent e)
public void mouseClicked(MouseEvent e)
react
will be called.
mouseClicked in interface MouseListenerpublic void mouseDragged(MouseEvent e)
drag
will be called.
mouseDragged in interface MouseMotionListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||