|
|||||||||
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 Sizeable
d
- the new Dimension
for this Imagepublic void setSize(int width, int height)
setSize
in interface Sizeable
public java.awt.Dimension getSize()
getSize
in interface Sizeable
Dimension
for this Imagepublic int getWidth()
getWidth
in interface Sizeable
getWidth
in class AbstractShape
public int getHeight()
getHeight
in interface Sizeable
getHeight
in class AbstractShape
public void setLocation(java.awt.Point p)
setLocation
in interface Locatable
setLocation
in class AbstractShape
p
- the new Point
for this Imagepublic void setLocation(int x, int y)
setLocation
in interface Locatable
setLocation
in class AbstractShape
public java.awt.Point getLocation()
getLocation
in interface Locatable
getLocation
in class AbstractShape
Point
for this Imagepublic int getXLocation()
getXLocation
in interface Locatable
getXLocation
in class AbstractShape
public int getYLocation()
getYLocation
in interface Locatable
getYLocation
in class AbstractShape
public void hide()
public void show()
public java.awt.Image getAWTImage()
public boolean contains(java.awt.Point p)
contains
in interface CustomGraphic
p
- the Point
to testpublic void setRotation(int degrees)
setRotation
in interface Rotatable
setRotation
in class AbstractShape
degrees
- the degrees (clockwise) that this should rotatepublic int getRotation()
getRotation
in interface Rotatable
getRotation
in class AbstractShape
public void paint(java.awt.Graphics2D g)
Rotate the Graphics Context if necessary, the paint, then reset the rotation
paint
in interface CustomGraphic
g
- the Graphics2D
you should use to paint your
graphicpublic java.awt.Rectangle getBounds()
Image
getBounds
in class AbstractShape
java.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 CustomGraphic
mouseClicked
in class AbstractGraphic
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface CustomGraphic
mouseDragged
in class AbstractGraphic
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface CustomGraphic
mousePressed
in class AbstractGraphic
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface CustomGraphic
mouseReleased
in class AbstractGraphic
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |