|
|||||||||
| 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.PictureComponent
Represents an image container that can be added to a DrawingPane
| 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 |
| 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 | |
PictureComponent(BufferedImage img)
You should not need to use this constructor |
|
PictureComponent(double x,
double y,
double width,
double height,
String imageFileName,
canvas.DrawingGrid dg)
Creates a new PictureComponent at the GridCoordinates x and y. |
|
PictureComponent(int x,
int y,
int width,
int height)
Only use this constructor only if you don't want to set the image file yet. |
|
PictureComponent(int x,
int y,
int width,
int height,
String imageFileName)
Use this constructor to set the Images location and dimensions. |
|
PictureComponent(String imageFileName)
Constructs a new PictureComponent for the given image file |
|
| Method Summary | |
boolean |
acceptDrop(Object dropped)
You should override this method in supclass to get drag/drop to work with your Components. |
void |
addDragListener()
Allows this PictureComponent to listen for Drag & Drop |
void |
addKeyboardListener()
Allows this PictureComponent to Listen for Arrow Keys Note: Only one shape will listen for key strokes at a time to obtain the focus for this shape, you need to call the Shape's getFocus() method. |
void |
addMouseListener()
Allows this PictureComponent to listen for Mouse Events. |
void |
dragDropEnd(DragSourceDropEvent dsde)
You should not need to use this method |
void |
dragEnter(DragSourceDragEvent dsde)
You should not need to use this method |
void |
dragExit(DragSourceEvent dse)
You should not need to use this method |
void |
dragOver(DragSourceDragEvent dsde)
You should not need to use this method |
void |
dropActionChanged(DragSourceDragEvent dsde)
You should not need to use this method |
canvas.DrawingPane |
getDrawingPane()
Returns the Drawing Pane that this PictureComponent has been added too. |
Color |
getPixel(int x,
int y)
Returns the color of the given pixel. |
Dimension |
getPreferredSize()
You should not need to use this method |
Object |
getTransferData(DataFlavor flavor)
You should not need to use this method |
DataFlavor[] |
getTransferDataFlavors()
You should not need to use this method |
boolean |
isDataFlavorSupported(DataFlavor flavor)
You should not need to use this method |
Image |
loadImage(String imageFile)
You should not need to use this method |
static void |
main(String[] args)
|
Object |
manufactureDroppable()
You should override this method in subclass to get drag/drop to work with your Components. |
void |
moveTo(double x,
double y)
Moves the PictureComponent to the given x,y location |
void |
moveTo(double x,
double y,
canvas.DrawingGrid dg)
Moves the PictureComponent to the given DrawingGrid coordinate (x, y). |
boolean |
okToDrag()
Returns whether it's OK to drag this object |
void |
paint(Graphics g)
you should not need to use this method |
void |
redraw()
Use this method whenever you want to update the display of this PictureComponent. |
void |
removeDragListener()
Removes this PictureComponents's ability to listen for Drag & Drop |
void |
removeKeyboardListener()
Removes this PictureComponent's ability to Listen for Arrow Keys |
void |
removeMouseListener()
Removes PictureComponent's ability to listen for Mouse Events. |
void |
repaint()
Use redraw() instead. |
void |
resetBorder()
You should not need to use this method |
void |
resizeTo(double width,
double height)
Resizes the picture to the given width and height |
void |
rotate(double degrees)
Rotates the PictureComponent the given number of degrees |
void |
rotateAbout(double degrees,
double x,
double y)
Rotates the PictureComponent the given number of degrees about the given x,y coordinates. |
void |
rotateAbout(double degrees,
double x,
double y,
canvas.DrawingGrid dg)
Rotates the PictureComponent the given number of degrees about the given DrawingGrid coordinate (x,y) |
static void |
setApplet(Applet a)
|
void |
setBounds(double x,
double y,
double width,
double height,
canvas.DrawingGrid dg)
|
void |
setBounds(int x,
int y,
int width,
int height)
This method sets the x,y location and the width and height of the PictureComponent. |
void |
setFeedbackText(String text)
If this PictureComponent is contained in a ViewFrame, this method will set the text of the ViewFrame's feedbadck label to be the given text |
void |
setImage(Image img)
This method is called by the other setImage method. |
void |
setImage(String imageFileName)
This sets the image to the given filename |
void |
setListener(canvas.DefaultListener newListener)
Will set the listener from the default to your subclass of a DefaultListener so you can obtain function from the listeners |
void |
setPixel(int x,
int y,
Color c)
Sets a specific pixel to a specific color |
void |
setPixel(int x,
int y,
int i)
Sets a specific pixel to a specific color |
void |
setPixel(int x,
int y,
int r,
int g,
int b)
Sets a specific pixel to a specific color |
void |
smoothMove(double x,
double y,
int milliseconds)
Moves the PictureComponent to the given x,y location in a smooth motion lasting approximately the given number of milliseconds |
void |
smoothMove(double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
Moves the PictureComponent to the given DrawingGrid coordinate (x,y) location in a smooth motion lasting approximately the given number of milliseconds. |
void |
smoothResize(double width,
double height,
int milliseconds)
Resizes the PictureComponent to the given width and height in a smooth motion lasting approximately the given number of milliseconds |
void |
smoothRotate(double degrees,
int milliseconds)
Rotates the PictureComponent the given number of degrees in a smooth motion lasting approximately the given number of milliseconds |
void |
smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds)
Rotates the PictureComponent the given number of degrees about the given x,y location in a smooth motion lasting approximately the given number of milliseconds |
void |
smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
Rotates the PictureComponent the given number of degrees about the given DrawingGrid coordinate (x,y) location in a smooth motion lasting approximately the given number of milliseconds. |
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 |
| Methods inherited from interface canvas.DragComponent |
setBorder |
| Constructor Detail |
public PictureComponent(String imageFileName)
public PictureComponent(int x,
int y,
int width,
int height)
public PictureComponent(int x,
int y,
int width,
int height,
String imageFileName)
public PictureComponent(double x,
double y,
double width,
double height,
String imageFileName,
canvas.DrawingGrid dg)
public PictureComponent(BufferedImage img)
| Method Detail |
public void redraw()
redraw in interface CanvasComponentpublic void repaint()
repaint in class Componentpublic static void setApplet(Applet a)
public void setImage(String imageFileName)
public canvas.DrawingPane getDrawingPane()
public void setBounds(int x,
int y,
int width,
int height)
setBounds in class Component
public void setBounds(double x,
double y,
double width,
double height,
canvas.DrawingGrid dg)
public void moveTo(double x,
double y)
moveTo in interface CanvasComponent
public void moveTo(double x,
double y,
canvas.DrawingGrid dg)
public void smoothMove(double x,
double y,
int milliseconds)
smoothMove in interface CanvasComponent
public void smoothMove(double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
public void resizeTo(double width,
double height)
resizeTo in interface CanvasComponent
public void smoothResize(double width,
double height,
int milliseconds)
smoothResize in interface CanvasComponentpublic void rotate(double degrees)
rotate in interface RotatingCanvasComponentdegrees - the number of degrees counter-clockwise
the PictureComponent is rotated
public void smoothRotate(double degrees,
int milliseconds)
smoothRotate in interface RotatingCanvasComponent
public void rotateAbout(double degrees,
double x,
double y)
rotateAbout in interface RotatingCanvasComponent
public void rotateAbout(double degrees,
double x,
double y,
canvas.DrawingGrid dg)
public void smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds)
smoothRotateAbout in interface RotatingCanvasComponent
public void smoothRotateAbout(double degrees,
double x,
double y,
int milliseconds,
canvas.DrawingGrid dg)
public void setPixel(int x,
int y,
int i)
x - The x coordiantey - The y coordinatei - The integer containing all 3 color values, ie 0xFF00FF
public void setPixel(int x,
int y,
int r,
int g,
int b)
x - The x coordinatey - The y coordinater - The Red component, 0-255g - The Green component, 0-255
public void setPixel(int x,
int y,
Color c)
x - The x coordinatey - The y coordiantec - The Color to set the pixel to
public Color getPixel(int x,
int y)
x - The x coordinatey - The y coordiantepublic static void main(String[] args)
public String toString()
toString in class Componentpublic void setImage(Image img)
public Dimension getPreferredSize()
getPreferredSize in class JComponentpublic void paint(Graphics g)
paint in class JComponentpublic Image loadImage(String imageFile)
public Object manufactureDroppable()
manufactureDroppable in interface DragComponentpublic boolean acceptDrop(Object dropped)
acceptDrop in interface DragComponentpublic boolean okToDrag()
DragComponent
okToDrag in interface DragComponentpublic void addMouseListener()
public void removeMouseListener()
public void addDragListener()
public void removeDragListener()
public void addKeyboardListener()
public void removeKeyboardListener()
public void setListener(canvas.DefaultListener newListener)
public void setFeedbackText(String text)
setFeedbackText in interface CanvasComponentpublic Object getTransferData(DataFlavor flavor)
getTransferData in interface Transferablepublic DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors in interface Transferablepublic boolean isDataFlavorSupported(DataFlavor flavor)
isDataFlavorSupported in interface Transferablepublic void dragDropEnd(DragSourceDropEvent dsde)
dragDropEnd in interface DragSourceListenerpublic void dragEnter(DragSourceDragEvent dsde)
dragEnter in interface DragSourceListenerpublic void dragExit(DragSourceEvent dse)
dragExit in interface DragSourceListenerpublic void dragOver(DragSourceDragEvent dsde)
dragOver in interface DragSourceListenerpublic void dropActionChanged(DragSourceDragEvent dsde)
dropActionChanged in interface DragSourceListenerpublic void resetBorder()
resetBorder in interface DragComponent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||