|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--canvas.ShapeComponent
Provides the infrastructure for drawing and using Arc, Ellipse, Line, and Rect objects.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
static boolean |
debug
|
String |
name
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
ShapeComponent(Shape shape)
Creates a ShapeComponent for the given Shape. |
|
ShapeComponent(Shape shape,
boolean filled)
Creates a ShapeComponent for the given Shape. |
|
ShapeComponent(Shape shape,
boolean filled,
Color c)
Creates a ShapeComponent for the given Shape. |
|
ShapeComponent(Shape shape,
Color c)
Creates a ShapeComponent for the given Shape. |
|
| Method Summary | |
void |
displace(double dx,
double dy)
Displaces this ShapeComponent by the given amount. |
void |
displace(double dx,
double dy,
canvas.DrawingGrid dg)
Displaces the ShapeComponent by the given DrawingGrid amount. |
canvas.DrawingPane |
getDrawingPane()
Returns the DrawingPane that this ShapeComponent has been added to. |
boolean |
getFilled()
Returns true if the shape is filled, and false if it is not |
Dimension |
getPreferredSize()
For discovering the "best" width and height of the component. |
Shape |
getShape()
Gets the shape out of this ShapeComponent. |
double |
getShapeHeight()
Returns the height of the shape |
double |
getShapeWidth()
Returns the widith of the shape |
double |
getShapeX()
Returns the X coodinate of the the shape |
double |
getShapeY()
Returns the Y coordinate of the shape |
void |
moveTo(double x,
double y)
Moves the Shape |
void |
moveTo(double x,
double y,
canvas.DrawingGrid dg)
Moves the ShapeComponent to be centered on DrawingGrid (x, y). |
void |
paint(Graphics g)
Paints the component. |
void |
redraw()
Use this method whenever you want to immediately update the display of this ShapeComponent. |
void |
resizeTo(double width,
double height)
Resizes the Shape |
void |
resizeTo(double width,
double height,
canvas.DrawingGrid dg)
Resizes the Shape to the specified DrawingGrid width and height. |
void |
rotate(double degrees)
Rotates the shape |
void |
rotateAbout(double degrees,
double x,
double y)
Rotates the shape About a Specific Point |
void |
rotateAbout(double degrees,
double x,
double y,
canvas.DrawingGrid dg)
Rotates the shape about a specific DrawingGrid point. |
static void |
setDebug(boolean debug)
Sets whether or not to print error messages |
void |
setFeedbackText(String text)
If this ShapeComponent is contained in a ViewFrame, then this will set the ViewFrame's Feedback Label to the given text |
void |
setFilled(boolean filled)
Sets whether or not to fill the shape when drawing. |
void |
smoothDisplace(double dx,
double dy,
int milliseconds)
|
void |
smoothDisplace(double dx,
double dy,
int milliseconds,
canvas.DrawingGrid dg)
|
void |
smoothMove(double x,
double y,
int milliseconds)
Moves the Shape over a Specific Amount of Time |
void |
smoothMove(double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
Moves the Shape over a specific amount of time to the DrawingGrid (x, y). |
void |
smoothResize(double width,
double height,
int milliseconds)
Resizes the Shape over a Specific Amount of Time |
void |
smoothResize(double width,
double height,
int milliseconds,
canvas.DrawingGrid dg)
Resizes the Shape to the specified DrawingGrid width and height over a specific amount of time. |
void |
smoothRotate(double degree,
int milliseconds)
Rotates the shape over a Specific Amount of Time |
void |
smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds)
Rotates the shape About a Specific Point over a Specific Time |
void |
smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface canvas.CanvasComponent |
getHeight, getWidth |
| Field Detail |
public static boolean debug
public String name
| Constructor Detail |
public ShapeComponent(Shape shape)
shape - any 'Shape'
public ShapeComponent(Shape shape,
boolean filled)
shape - any 'Shape'filled - whether or not to fill in the shape
public ShapeComponent(Shape shape,
Color c)
shape - any 'Shape'c - the color to be used to draw the shape
public ShapeComponent(Shape shape,
boolean filled,
Color c)
shape - any 'Shape'filled - whether or not to fill the shape with colorc - the color with which to draw the shape| Method Detail |
public static void setDebug(boolean debug)
public void redraw()
redraw in interface CanvasComponentpublic double getShapeX()
public double getShapeY()
public double getShapeWidth()
public double getShapeHeight()
public void setFilled(boolean filled)
filled - whether or not to fill the shape when drawing.public boolean getFilled()
public void displace(double dx,
double dy)
public void displace(double dx,
double dy,
canvas.DrawingGrid dg)
public void smoothDisplace(double dx,
double dy,
int milliseconds)
public void smoothDisplace(double dx,
double dy,
int milliseconds,
canvas.DrawingGrid dg)
public canvas.DrawingPane getDrawingPane()
public Shape getShape()
public Dimension getPreferredSize()
getPreferredSize in class JComponentpublic void paint(Graphics g)
paint in class JComponentg - the graphics context in which to drawpublic void rotate(double degrees)
rotate in interface RotatingCanvasComponentdegrees - the number of degrees the shape is rotated
counter clockwise
public void smoothRotate(double degree,
int milliseconds)
smoothRotate in interface RotatingCanvasComponentmilliseconds - the amount of time the rotation will take
public void rotateAbout(double degrees,
double x,
double y)
rotateAbout in interface RotatingCanvasComponentdegrees - the number of degrees the shape is rotated
counter clockwisex - the x coord of the rotation pointy - the y coord of the rotation point
public void rotateAbout(double degrees,
double x,
double y,
canvas.DrawingGrid dg)
degrees - the number of degrees the shape is rotated
counter clockwisex - the x DrawingGrid coord of the rotation pointy - the y DrawingGrid coord of the rotation point
public void smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds)
smoothRotateAbout in interface RotatingCanvasComponentdegrees - the number of degrees the shape is rotated
counter clockwisex - the x coord of the rotation pointy - the y coord of the rotation pointmilliseconds - the amount of time rotation will take
public void smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
public void resizeTo(double width,
double height)
resizeTo in interface CanvasComponentwidth - the desired widthheight - the desired height
public void resizeTo(double width,
double height,
canvas.DrawingGrid dg)
public void smoothResize(double width,
double height,
int milliseconds)
smoothResize in interface CanvasComponentwidth - the desired widthheight - the desired heightmilliseconds - time resizing will take
public void smoothResize(double width,
double height,
int milliseconds,
canvas.DrawingGrid dg)
public void moveTo(double x,
double y)
moveTo in interface CanvasComponentx - the desired x locationy - the desired y location
public void moveTo(double x,
double y,
canvas.DrawingGrid dg)
public void smoothMove(double x,
double y,
int milliseconds)
smoothMove in interface CanvasComponentx - the desired x locationy - the desired y locationmilliseconds - time move will take
public void smoothMove(double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
public void setFeedbackText(String text)
setFeedbackText in interface CanvasComponentpublic String toString()
toString in class Component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||