|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
ciips.animation.BasicDrawingPanel
ciips.animation.DrawingPanel
DrawingPanel
is the graphical panel attached to the
animation frame AlgAnimFrame
. It contains the methods
to draw objects for the animation algorithm or instances of another
classes, which contain the drawing methods.
This class is NOT TO BE MODIFIED.
Any object class which implements the interface DrawingObj
can be added to this panel by calling the addDrawingObj()
method. Similarly, commentary box of type ComBox
can be
added to the panel by using addCom
method. Since the
commentary box (ComBox
) is also implementing the interface
DrawingObj
, it can also be added by using the
addDrawingObj
method. However, ComBox
added
to the drawing panel by using addCom
will always appear on
top of any object added to the panel by using the addDrawingObj
method.
Note that last object added to the panel will be displayed on top.
AlgAnimFrame.getDrawingPanel()
,
DrawingObj
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class ciips.animation.BasicDrawingPanel |
offGraphics, offscreen, offscreensize, predecessor, pref_size |
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 | |
DrawingPanel()
Creates a panel with white background and initializes the fonts to be used during the animation. |
|
DrawingPanel(int width,
int height)
Constructor which allows the default height and width to be overridden |
Method Summary | |
void |
addCom(ComBox com)
Adds a commentary box to the drawing panel. |
void |
addDrawingObj(DrawingObj obj)
Adds a drawing object to the canvas. |
void |
animate(DrawingObj[] objs,
java.util.Vector[] pts)
Animate a list of drawing objects store in an array. |
void |
animate(DrawingObj a,
Trajectory t)
Animate a single drawing object along a trajectory |
void |
animate(DrawingObj obj,
java.util.Vector pts)
Animate a single drawing object through a sequence of points specified by the Vector construction. |
void |
delay()
Invoke a delay for a certain duration specified by setDelay(int) . |
java.awt.Font |
getBigFont()
Returns the font objects initialized during the class initialization, which can be readily used during the animation. |
java.awt.Font |
getFixFont()
Return font objects initialized during the class initialization, which can be readily used during the animation. |
java.awt.Font |
getHugeFont()
Return font objects initialized during the class initialization, which can be readily used during the animation. |
boolean |
getNoAnim()
Check if the noAnim flag is set. |
int |
getOffset()
Get the number of pixel towards the edge of the panel which are not going to be drawn. |
int |
getPanelHeight()
Get the height of the drawing panel. |
int |
getPanelWidth()
Get the width of the drawing panel. |
boolean |
getSkip()
Check if the animationis in the skip mode. |
java.awt.Font |
getSmallFont()
Return font objects initialized during the class initialization, which can be readily used during the animation. |
java.awt.Font |
getTinyFont()
Return font objects initialized during the class initialization, which can be readily used during the animation. |
void |
init()
Initialize the commentary boxes and drawing objects, removing all of them from the drawing panel. |
boolean |
isComExist(ComBox com)
Check if a commentary box has already been added to the drawing panel. |
boolean |
isObjExist(DrawingObj obj)
Checks if a certain object has already been added to the drawing panel. |
void |
paint(java.awt.Graphics g)
Method to draw objects on the drawing panel. |
void |
redraw()
Calls repaint() followed by delay(). |
void |
removeAllCom()
Remove all commentary boxes |
void |
removeCom(ComBox com)
Remove the commentary box. |
boolean |
removeObj(DrawingObj obj)
Remove a drawing object which matches the parameter. |
void |
setAnimStep(int step)
Set the animation step, i.e. |
void |
setDelay(int delay)
Set the delay duration between animation update. |
void |
setNoAnim(boolean noAnim)
Disable or enable animation. |
void |
setSkip(boolean skip)
Set if the animation is in the 'SKIP' . |
void |
shortDelay()
Causing a short delay of 1/3 of the normal delay duration. |
void |
update(java.awt.Graphics g)
This method is invoked when the repaint() method is called. |
Methods inherited from class ciips.animation.BasicDrawingPanel |
clear, drawFromOffscreen, getImage, getOffScreenGraphics, getPreferredSize, makeOffScreenBuffer, setImage, setPredecessor, setPreferredSize, shuffleDown |
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DrawingPanel()
getBigFont()
,
getSmallFont()
,
getTinyFont()
,
getHugeFont()
,
getFixFont()
public DrawingPanel(int width, int height)
Method Detail |
public void init()
public void shortDelay()
public void delay()
setDelay(int)
.
setDelay(int)
public void setDelay(int delay)
delay
- Delay duration in milliseconds.public void redraw()
redraw
in class BasicDrawingPanel
public void update(java.awt.Graphics g)
repaint()
method is called.
The update
method is overriden here to eliminate flashing.
g
- Graphical contextpublic void paint(java.awt.Graphics g)
paint
in class BasicDrawingPanel
public java.awt.Font getBigFont()
public java.awt.Font getSmallFont()
getBigFont()
public java.awt.Font getTinyFont()
getBigFont()
public java.awt.Font getHugeFont()
getBigFont()
public java.awt.Font getFixFont()
getBigFont()
public int getPanelHeight()
repaint()
method.public int getPanelWidth()
repaint()
method.public int getOffset()
public void setSkip(boolean skip)
skip
- TRUE if the algorithm animation is to be fast forwarded
to a specific point of execution. FALSE otherwise.public void setNoAnim(boolean noAnim)
noAnim
- true
is animation is to be disabled,
false
otherwise.public boolean getNoAnim()
public boolean getSkip()
public void addDrawingObj(DrawingObj obj)
obj
- The object to be added.public boolean isObjExist(DrawingObj obj)
obj
- The drawing object to be checked.
public boolean removeObj(DrawingObj obj)
obj
- The drawing object to be removed.
public void addCom(ComBox com)
com
- The commentary box to be added.public boolean isComExist(ComBox com)
com
- The commentary box to be checked.
public void removeCom(ComBox com)
com
- The combox to be removed.public void removeAllCom()
public void setAnimStep(int step)
step
- The number of animation step.public void animate(DrawingObj obj, java.util.Vector pts)
Vector
construction.
Each element of the vector is of type Point, where the first
is the source and the last is the destination of the trajectory
to be animated on the object.
obj
- The drawing object to be move.pts
- The trajectory the drawing object is to be moved.public void animate(DrawingObj a, Trajectory t)
public void animate(DrawingObj[] objs, java.util.Vector[] pts)
objs
- Array holding the drawing objects to be animated.pts
- Array holding the trajectories of the drawing objects.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |