|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwheels.users.Image
A class that can display an image on a DrawingPanel.
| Constructor Summary | |
Image(DrawingPanel dp,
String file)
Create an image from the specified filename, in the specified DrawingPanel. |
|
Image(DrawingPanel dp,
URL url)
Create an image from a URL. |
|
Image(String file)
Create an image from the specified filename, in the wheels.users.Frame's DrawingPanel. |
|
Image(URL url)
Create an image from the specified URL, in the wheels.users.Frame's DrawingPanel. |
|
| 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 |
int |
getHeight()
Returns the height of this Image. |
Point |
getLocation()
Get the location of this Image |
int |
getRotation()
Get the rotation for this Image |
Dimension |
getSize()
Get the dimensions of this Image |
int |
getWidth()
Returns the width of the Image. |
int |
getXLocation()
Get the x value of the Image's location. |
int |
getYLocation()
Get the y value of the Image's location. |
void |
hide()
Hide the Image so it won't paint |
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 |
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 |
setLocation(int x,
int y)
Set the location of the Image. |
void |
setLocation(Point p)
Set the location of this Image |
void |
setRotation(int degrees)
Set the rotation for this Image |
void |
setSize(Dimension d)
Set the dimensions of this Image |
void |
setSize(int width,
int height)
Set the dimensions of this Image |
protected void |
setup(DrawingPanel dp)
Normal users need not use this! |
void |
show()
Show the Image so it paints |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Image(String file)
file - the filename to take this image form (gif or jpg).public Image(URL url)
url - the URL to take this image form (gif or jpg)
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)| Method Detail |
protected void setup(DrawingPanel dp)
Use the media tracker to load the image, then initialize everything else.
public void setSize(Dimension d)
setSize in interface Sizeabled - the new Dimension for this Image
public void setSize(int width,
int height)
setSize in interface Sizeablepublic Dimension getSize()
getSize in interface SizeableDimension for this Imagepublic int getWidth()
getWidth in interface Sizeablepublic int getHeight()
getHeight in interface Sizeablepublic void setLocation(Point p)
setLocation in interface Locatablep - the new Point for this Image
public void setLocation(int x,
int y)
setLocation in interface Locatablepublic Point getLocation()
getLocation in interface LocatablePoint for this Imagepublic int getXLocation()
getXLocation in interface Locatablepublic int getYLocation()
getYLocation in interface Locatablepublic void hide()
public void show()
public Image getAWTImage()
public boolean contains(Point p)
contains in interface CustomGraphicp - the Point to testpublic void setRotation(int degrees)
degrees - the degrees (clockwise) that this should rotatepublic int getRotation()
public void paint(Graphics2D g)
Rotate the Graphics Context if necessary, the paint, then reset the rotation
paint in interface CustomGraphicg - the Graphics2D you should use to paint your
graphicpublic Rectangle getBounds()
Image
java.awt.Rectangle that indicates our bounds.public void drag(MouseEvent e)
public void mouseClicked(MouseEvent e)
mouseClicked in interface CustomGraphicpublic void mouseDragged(MouseEvent e)
mouseDragged in interface CustomGraphicpublic void mousePressed(MouseEvent e)
mousePressed in interface CustomGraphicpublic void mouseReleased(MouseEvent e)
mouseReleased in interface CustomGraphic
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||