ciips.animation
Class TextPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byciips.animation.TextPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TextPanel
extends java.awt.Panel

Text panel to display the source code of the animation algorithm. This class is initialized in the TextFrame class construction during the main frame initialization. Each line of the source code starting with /*- will be ignored. The line after /*------- is considered as the first line of text being displayed. The line before //- is the last line of source code being displayed. The text after this line will no longer be parsed. See also AlgThread for special symbol used in displaying source code in text panel.

This method should NOT have to be called manually.

See Also:
TextFrame, AlgAnimFrame, Serialized Form

Nested 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 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
TextPanel(java.lang.String fn)
          Creates a text panel based on the source file specified in the String passed in as the parameter.
TextPanel(java.net.URL sourceURL)
          Creates a text frame based on the URL specified by the parameter.
 
Method Summary
 int getLineSpace()
          Get the number of pixels used by each line of text.
 java.awt.Dimension getMinimumSize()
          Return the minimum allowed dimension of the text panel.
 int getNumLines()
          Get the number of lines of source code to be displayed on the text panel.
 java.awt.Dimension getPreferredSize()
          Returns the initial dimension of the text panel.
 int getStart()
          Get the first line of the source code that will be displayed.
 void Highlight(int h)
          Highlight a certain line of the source code.
 void paint(java.awt.Graphics g)
          This method print the source code starting from the first line specified by setStart(int) on the text panel.
 void setStart(int start)
          Set the first line to display.
 void update(java.awt.Graphics g)
          This method is invoked when the repaint() method of the parent class is called.
 
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, 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

TextPanel

public TextPanel(java.lang.String fn)
Creates a text panel based on the source file specified in the String passed in as the parameter.

Parameters:
fn - Filename of the source code

TextPanel

public TextPanel(java.net.URL sourceURL)
Creates a text frame based on the URL specified by the parameter.

Parameters:
sourceURL - URL of the source code
See Also:
URL
Method Detail

Highlight

public void Highlight(int h)
Highlight a certain line of the source code. The highlighted line is displayed in RED while the other normal lines are displayed in BLACK. The first line of the source has a line index of 0.

Parameters:
h - The line to be highlighted

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the initial dimension of the text panel. This method will be called by the layout manager during the corresponding frame initialization.


getMinimumSize

public java.awt.Dimension getMinimumSize()
Return the minimum allowed dimension of the text panel.


update

public void update(java.awt.Graphics g)
This method is invoked when the repaint() method of the parent class is called. This method eliminates flashing during animation.


setStart

public void setStart(int start)
Set the first line to display.

Parameters:
start - First line to display
See Also:
getStart()

paint

public void paint(java.awt.Graphics g)
This method print the source code starting from the first line specified by setStart(int) on the text panel.

Parameters:
g - Graphical context of the text panel.

getNumLines

public int getNumLines()
Get the number of lines of source code to be displayed on the text panel.

Returns:
The number of lines of source code to be displayed on the text frame.

getLineSpace

public int getLineSpace()
Get the number of pixels used by each line of text.

Returns:
The number of pixels allocated for each line of text.

getStart

public int getStart()
Get the first line of the source code that will be displayed. This attribute is used to couple the text panel to a vertical scrollbar in the TextFrame.

Returns:
The first line of source code that will be displayed.