Class Picture
- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.Rectangle
-
- org.htmlparser.lexerapplications.thumbelina.Picture
-
- All Implemented Interfaces:
java.awt.Shape,java.io.Serializable,java.lang.Cloneable
public class Picture extends java.awt.RectangleClass to track pictures within the frame. Maintains an image, an area and the URL for it.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.ImagemImageThe image for the picture.protected java.awt.PointmOriginThe upper left hand corner of the image.protected java.net.URLmURLThe URL for the picture.static java.awt.PointORIGINThe origin for new points from the zero args constructor.
-
Constructor Summary
Constructors Constructor Description Picture()Construct a Picture.Picture(int x, int y, int width, int height)Construct a Picture over the area given.Picture(java.awt.Rectangle r)Construct a picture over the rectangle given.Picture(Picture picture)Construct a picture from the one given.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ImagegetImage()Getter for property image.java.awt.PointgetOrigin()Getter for property origin.java.net.URLgetURL()Getter for property URL.voidreset()Reset the picture to uncropped size.booleansame(Picture picture)Returntrueif that picture is the same as this one.voidsetImage(java.awt.Image image)Setter for property image.voidsetOrigin(java.awt.Point origin)Setter for property origin.voidsetURL(java.net.URL url)Setter for property URL.java.lang.StringtoString()Create a string representation of the picture.-
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
-
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
-
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
-
-
-
Field Detail
-
ORIGIN
public static final java.awt.Point ORIGIN
The origin for new points from the zero args constructor.
-
mURL
protected java.net.URL mURL
The URL for the picture.
-
mImage
protected java.awt.Image mImage
The image for the picture.
-
mOrigin
protected java.awt.Point mOrigin
The upper left hand corner of the image. This doesn't change, even if the image is cropped. For example, if the left half of the image is obscured by another, theRectanglefieldsx,y,widthandheightwill change, but the origin remains the same.
-
-
Constructor Detail
-
Picture
public Picture()
Construct a Picture.
-
Picture
public Picture(int x, int y, int width, int height)Construct a Picture over the area given.- Parameters:
x- The x coordinate.y- The y coordinate.width- The width of the picture.height- The height of the picture.
-
Picture
public Picture(java.awt.Rectangle r)
Construct a picture over the rectangle given.- Parameters:
r- The coordinates of the area.
-
Picture
public Picture(Picture picture)
Construct a picture from the one given.- Parameters:
picture- The picture to copy.
-
-
Method Detail
-
getURL
public java.net.URL getURL()
Getter for property URL.- Returns:
- Value of property URL.
-
setURL
public void setURL(java.net.URL url)
Setter for property URL.- Parameters:
url- New value of property URL.
-
getImage
public java.awt.Image getImage()
Getter for property image.- Returns:
- Value of property image.
-
setImage
public void setImage(java.awt.Image image)
Setter for property image.- Parameters:
image- New value of property image.
-
getOrigin
public java.awt.Point getOrigin()
Getter for property origin.- Returns:
- Value of property origin.
-
setOrigin
public void setOrigin(java.awt.Point origin)
Setter for property origin.- Parameters:
origin- New value of property origin.
-
same
public boolean same(Picture picture)
Returntrueif that picture is the same as this one.- Parameters:
picture- The picture to check.- Returns:
trueif the images match.
-
reset
public void reset()
Reset the picture to uncropped size.
-
toString
public java.lang.String toString()
Create a string representation of the picture.- Overrides:
toStringin classjava.awt.Rectangle- Returns:
- A string that shows this picture URL and size.
-
-