org.activemath.applets
Class ConsoleArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.TextComponent
          extended by java.awt.TextArea
              extended by org.activemath.applets.ConsoleArea
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ConsoleArea
extends TextArea

This class is a TextArea which behaves like a Unix-Shell.
If the User entered a Command (this means has typed ENTER) an ActionEvent is thrown an the method getActionCommand() of ActionEvent returns a String Representation of the user-input.
After a command was entered the Console is disabled for input until setResult() is called.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.TextArea
TextArea.AccessibleAWTTextArea
 
Nested classes/interfaces inherited from class java.awt.TextComponent
TextComponent.AccessibleAWTTextComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static Font consoleFont
           
 
Fields inherited from class java.awt.TextArea
SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY
 
Fields inherited from class java.awt.TextComponent
textListener
 
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
ConsoleArea()
          A Constructor without parameters Creates a new Console with Default size.
ConsoleArea(int rows, int lines)
          The Constructor.
 
Method Summary
 void addActionListener(ActionListener listener)
          This Method is used for adding a new ActionListener which will receive ActionEvents from this Component.
 void adjustFont()
           
 String beautify(String text)
          This method is to split a OneLineResult into a result that splits the result by the newlines into several lines and removes double newlines.
 void processKeyEvent(KeyEvent e)
          this Method is envoked if the user types a Key.
 void removeActionListener(ActionListener listener)
          With this Method you can remove listeners again if you want to.
 void setEditable(boolean flag)
          Overwrites the setEditable Method of TextArea.
 void setResult(String result)
          With this Method you can set the result for an entered command.
 
Methods inherited from class java.awt.TextArea
addNotify, append, appendText, getAccessibleContext, getColumns, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, getRows, getScrollbarVisibility, insert, insertText, minimumSize, minimumSize, paramString, preferredSize, preferredSize, replaceRange, replaceText, setColumns, setRows
 
Methods inherited from class java.awt.TextComponent
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getListeners, getSelectedText, getSelectionEnd, getSelectionStart, getText, getTextListeners, isEditable, processEvent, processTextEvent, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setSelectionEnd, setSelectionStart, setText
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, 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, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

consoleFont

public static final Font consoleFont
Constructor Detail

ConsoleArea

public ConsoleArea()
A Constructor without parameters Creates a new Console with Default size.


ConsoleArea

public ConsoleArea(int rows,
                   int lines)
The Constructor.
Creates a new Console with the specified number of rows and lines.

Parameters:
rows - The desired number of rows.
lines - The desired number of lines
Method Detail

adjustFont

public void adjustFont()

setEditable

public void setEditable(boolean flag)
Overwrites the setEditable Method of TextArea.
With this Method you can disable or enable the User to do some input to the Console.

Overrides:
setEditable in class TextComponent
Parameters:
flag - This flag indicates wether the Console should be editable or not.

setResult

public void setResult(String result)
With this Method you can set the result for an entered command.
It will always occur just beneath the entered command and above the actual Command prompt.

Parameters:
result - The result to be inserted into the Console.

beautify

public String beautify(String text)
This method is to split a OneLineResult into a result that splits the result by the newlines into several lines and removes double newlines.


processKeyEvent

public void processKeyEvent(KeyEvent e)
this Method is envoked if the user types a Key.

Overrides:
processKeyEvent in class Component

addActionListener

public void addActionListener(ActionListener listener)
This Method is used for adding a new ActionListener which will receive ActionEvents from this Component.

Parameters:
listener - the class which implements the Interface and should be noticed of Events.

removeActionListener

public void removeActionListener(ActionListener listener)
With this Method you can remove listeners again if you want to.

Parameters:
listener - the listener-class which should be removed.