|
|||||||||
| 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
|
+--javax.swing.JLayeredPane
|
+--canvas.DrawingPane
Provides support for drawing shapes in a window.
When a Component is added to this DrawingPane, it
is displayed in the window that contains this DrawingPane. Since a
DrawingPane is a Component, one DrawingPane containing
an arrangement of other items can be added to another DrawingPane. This
type of modular structure is encouraged. A DrawingPane also provides the
smooth movement and resizing of CanvasComponents and smooth
rotation of RotatingCanvasComponents.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JLayeredPane |
JLayeredPane.AccessibleJLayeredPane |
| 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 | |
Object |
involvedInDrop
|
| Fields inherited from class javax.swing.JLayeredPane |
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
| 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 | |
DrawingPane()
Creates a DrawingPane with a white background that is initially 640 pixels wide and 480 pixels high. |
|
DrawingPane(Color background,
int width,
int height)
Creates a DrawingPane with the given title, background color, and size. |
|
DrawingPane(int width,
int height)
Creates a DrawingPane with the given width and height |
|
| Method Summary | |
boolean |
acceptDrop(Object dropped)
You should override this method in supclass to get drag/drop to work with your shapes. |
Component |
add(Component c)
Puts the given Component on the DrawingPane using the Component's preferred size. |
Component |
add(Component c,
int x,
int y)
Puts the given Component on the DrawingPane using the Component's preferred size at the given x,y location. |
void |
addDragListener()
Allows this DrawingPane to listen for Drag & Drop |
void |
addKeyboardListener()
Allows this DrawingPane to Listen for Arrow Keys Note: Only one object will listen for key strokes at a time to obtain the focus for this object, you need to call the object's getFocus() method. |
void |
addMouseListener()
Allows this DrawingPane 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 |
int |
getHeight()
Returns the Height of the DrawingPane |
Object |
getTransferData(DataFlavor flavor)
You should not need to use this method |
DataFlavor[] |
getTransferDataFlavors()
You should not need to use this method |
int |
getWidth()
Returns the Width of the DrawingPane |
boolean |
isDataFlavorSupported(DataFlavor flavor)
You should not need to use this method |
Object |
manufactureDroppable()
You should override this method in subclass to get drag/drop to work with your DrawingPane. |
void |
moveTo(double x,
double y)
Moves the pane to the given coordinates in its container. |
void |
moveToBack(Component c)
Moves the given Component behind of all other Components. |
void |
moveToFront(Component c)
Moves the given Component on top of all other Components. |
boolean |
okToDrag()
Called on DragComponent to see if it can be Dragged. |
void |
redraw()
Calls Component.repaint() in a thread-safe way. |
void |
remove(Component c)
Takes the given Component off the DrawingPane. |
void |
removeDragListener()
Removes this DrawingPane's ability to listen for Drag & Drop |
void |
removeKeyboardListener()
Removes this DrawingPane's ability to Listen for Arrow Keys |
void |
removeMouseListener()
Removes DrawingPane's ability to listen for Mouse Events. |
void |
resetBorder()
You should not need to use this method |
void |
resizeTo(double width,
double height)
Resizes the pane to the given dimensions. |
void |
setColor(Color color)
Sets the Color of the DrawingPane, Note: you need to call setOpaque(true) to make it visible. |
void |
setFeedbackText(String text)
If this DrawingPane is contained in a ViewFrame, then this method will set the ViewFrame's Feedback Label to be the given text |
void |
setLayer(Component c,
int layer)
Changes the layer of a component. |
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 |
setOpaque(boolean opaque)
Sets whether the DrawingPane is visible or not. |
void |
sleep(int milliseconds)
Creates a time delay of approximately the given length. |
void |
smoothMove(Component c,
double newX,
double newY,
int milliseconds)
Moves the given component to the given x,y position in a straight-line smooth motion animation lasting approximately the given length of time. |
void |
smoothMove(double x,
double y,
int milliseconds)
Smoothly moves this component to the given coordinates over the time interval given. |
void |
smoothResize(canvas.CanvasComponent c,
double newWidth,
double newHeight,
int milliseconds)
Resizes the given component to the given size lasting approximately the the given length of time. |
void |
smoothResize(double width,
double height,
int milliseconds)
Smoothly resizes this component to the given dimensions over the time interval given. |
void |
smoothRotate(Component c,
double degree,
int milliseconds)
Rotates the given component to the given degree in a smooth motion lasting approximately the given length of time. |
void |
smoothRotateAbout(canvas.RotatingCanvasComponent c,
double degree,
double x,
double y,
int milliseconds)
Rotates the given component to the given degree about the specified point in a smooth motion lasting approximately the given length of time. |
String |
toString()
Returns a string of the format "DrawingPane size:(x,y)" |
| Methods inherited from class javax.swing.JLayeredPane |
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, paint, paramString, putLayer, remove, setLayer, setPosition |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface canvas.DragComponent |
setBorder |
| Field Detail |
public Object involvedInDrop
| Constructor Detail |
public DrawingPane()
public DrawingPane(int width,
int height)
width - the width of the DrawingPaneheight - the height of the DrawingPane
public DrawingPane(Color background,
int width,
int height)
background - a value of type 'Color'width - a value of type 'int'height - a value of type 'int'| Method Detail |
public void moveTo(double x,
double y)
moveTo in interface CanvasComponent
public void resizeTo(double width,
double height)
resizeTo in interface CanvasComponentpublic void redraw()
CanvasComponentComponent.repaint() in a thread-safe way.
The component is re-drawn on the screen. This is especially useful for PictureComponent objects.
redraw in interface CanvasComponent
public void smoothResize(double width,
double height,
int milliseconds)
CanvasComponent
smoothResize in interface CanvasComponent
public void smoothMove(double x,
double y,
int milliseconds)
CanvasComponent
smoothMove in interface CanvasComponentpublic void setColor(Color color)
public int getWidth()
getWidth in interface CanvasComponentgetWidth in class JComponentpublic int getHeight()
getHeight in interface CanvasComponentgetHeight in class JComponentpublic Component add(Component c)
add in class Containerc - the Component to be added
public Component add(Component c,
int x,
int y)
c - the Component to be addedx - the x position for the upper left corner of the Componenty - the y position for the upper left corner of the Componentpublic void remove(Component c)
remove in class Containerc - the Component to be removedpublic void moveToFront(Component c)
moveToFront in class JLayeredPanec - the Component to be moved to the front
public void setLayer(Component c,
int layer)
setLayer in class JLayeredPanec - the Componentlayer - the new layer for the Componentpublic void moveToBack(Component c)
moveToBack in class JLayeredPanec - the Component to be moved to the backpublic void setOpaque(boolean opaque)
setOpaque in class JComponentopaque - true will set the DrawingPane to be visible, false will set it invisible
public void smoothMove(Component c,
double newX,
double newY,
int milliseconds)
c - the component to be movednewX - the destination x coordinatenewY - the destination y coordinatemilliseconds - the desired length of time for the animation
public void smoothRotate(Component c,
double degree,
int milliseconds)
c - the component to be moveddegree - the number of degrees to rotatemilliseconds - the desired length of time for the animation
public void smoothRotateAbout(canvas.RotatingCanvasComponent c,
double degree,
double x,
double y,
int milliseconds)
c - the component to rotatedegree - the number of degrees to rotatex - The x coordinate of the point to rotate abouty - the y coordinate of the point to rotate aboutmilliseconds - the desired length of time for the animation
public void smoothResize(canvas.CanvasComponent c,
double newWidth,
double newHeight,
int milliseconds)
c - the component to be resizednewWidth - the width the component will be resized tonewHeight - the height the component will be resized tomilliseconds - the desired length of time for the animationpublic void setFeedbackText(String text)
setFeedbackText in interface CanvasComponentpublic void sleep(int milliseconds)
milliseconds - the desired length of the delay, in millisecondspublic String toString()
toString in class Componentpublic Object manufactureDroppable()
manufactureDroppable in interface DragComponentpublic boolean acceptDrop(Object dropped)
acceptDrop in interface DragComponentpublic boolean okToDrag()
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 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 | ||||||||