|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwheelsunh.etc.AbstractGraphic
wheelsunh.users.AbstractShape
wheelsunh.users.Image
public class Image
A class that can display an image on a DrawingPanel.
| Field Summary |
|---|
| Fields inherited from class wheelsunh.users.AbstractShape |
|---|
_rot |
| Constructor Summary | |
|---|---|
Image(DrawingPanel dp,
java.lang.String file)
Create an image from the specified filename, in the specified DrawingPanel. |
|
Image(DrawingPanel dp,
java.net.URL url)
Create an image from a URL. |
|
Image(java.awt.Image awtImage)
Create a wheels image from awt Image A UNH wheels extension. |
|
Image(int w,
int h)
Create an Image object of a give size, but no image yet. |
|
Image(int w,
int h,
int iType)
Create an Image object of a give size and type but no image yet. |
|
Image(java.lang.String file)
Create an image from the specified filename, in the wheelsunh.users.Frame's DrawingPanel. |
|
Image(java.net.URL url)
Create an image from the specified URL, in the wheelsunh.users.Frame's DrawingPanel. |
|
| Method Summary | |
|---|---|
boolean |
contains(java.awt.Point p)
See if this Image contains the Point |
void |
drag(java.awt.event.MouseEvent e)
Override to do something useful. |
java.awt.Image |
getAWTImage()
Get the AWT Image that we are using, not necessary for most users. |
java.awt.Rectangle |
getBounds()
Get the rectangle that indicates the bounds of this Image |
int |
getHeight()
Returns the height of this Image. |
java.awt.Point |
getLocation()
Get the location of this Image |
int |
getRotation()
Get the rotation for this Image |
java.awt.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(java.awt.event.MouseEvent e)
Called when the Panel detects that the mouse was clicked. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Called when the Panel detects that the mouse was dragged. |
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the Panel detects that the mouse was pressed. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Called when the Panel detects that the mouse was released. |
void |
paint(java.awt.Graphics2D g)
Normal users need not use this! |
protected void |
setAWTImage(java.awt.Image newImage)
set the internal awt version of the image; UNH extension: On MacOSX, we get image objects of type apple.awt.OSXImage. |
void |
setLocation(int x,
int y)
Set the location of the Image. |
void |
setLocation(java.awt.Point p)
Set the location of this Image |
void |
setRotation(int degrees)
Set the rotation for this Image |
void |
setSize(java.awt.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 wheelsunh.users.AbstractShape |
|---|
boundsIntersects, center, distance, getCenter, getCenterX, getCenterY, getIntersection, intersects, intersects, setCenter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Image(int w,
int h)
public Image(int w,
int h,
int iType)
public Image(java.lang.String file)
file - the filename to take this image form (gif or jpg).public Image(java.net.URL url)
url - the URL to take this image form (gif or jpg)
public Image(DrawingPanel dp,
java.lang.String file)
dp - the DrawingPanel for this imagefile - the filename to take this image form (gif or jpg).
public Image(DrawingPanel dp,
java.net.URL url)
dp - the DrawingPanel for this imageurl - the URL to take this image form (gif or jpg)public Image(java.awt.Image awtImage)
awtImage - | Method Detail |
|---|
protected void setup(DrawingPanel dp)
Use the media tracker to load the image, then initialize everything else.
protected void setAWTImage(java.awt.Image newImage)
public void setSize(java.awt.Dimension d)
setSize in interface Sizeabled - the new Dimension for this Image
public void setSize(int width,
int height)
setSize in interface Sizeablepublic java.awt.Dimension getSize()
getSize in interface SizeableDimension for this Imagepublic int getWidth()
getWidth in interface SizeablegetWidth in class AbstractShapepublic int getHeight()
getHeight in interface SizeablegetHeight in class AbstractShapepublic void setLocation(java.awt.Point p)
setLocation in interface LocatablesetLocation in class AbstractShapep - the new Point for this Image
public void setLocation(int x,
int y)
setLocation in interface LocatablesetLocation in class AbstractShapepublic java.awt.Point getLocation()
getLocation in interface LocatablegetLocation in class AbstractShapePoint for this Imagepublic int getXLocation()
getXLocation in interface LocatablegetXLocation in class AbstractShapepublic int getYLocation()
getYLocation in interface LocatablegetYLocation in class AbstractShapepublic void hide()
public void show()
public java.awt.Image getAWTImage()
public boolean contains(java.awt.Point p)
contains in interface CustomGraphicp - the Point to testpublic void setRotation(int degrees)
setRotation in interface RotatablesetRotation in class AbstractShapedegrees - the degrees (clockwise) that this should rotatepublic int getRotation()
getRotation in interface RotatablegetRotation in class AbstractShapepublic void paint(java.awt.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 java.awt.Rectangle getBounds()
Image
getBounds in class AbstractShapejava.awt.Rectangle that indicates our bounds.public void drag(java.awt.event.MouseEvent e)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface CustomGraphicmouseClicked in class AbstractGraphicpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface CustomGraphicmouseDragged in class AbstractGraphicpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface CustomGraphicmousePressed in class AbstractGraphicpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface CustomGraphicmouseReleased in class AbstractGraphic
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||