All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class benno.awt.MatrixEditor

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----benno.awt.MatrixEditor

public class MatrixEditor
extends Panel
implements ActionListener, TextListener
This class provides an AWT component to edit a matrix. A benno.linalg.Matrix object must be supplied - it will be the entries of this matrix which will be modified. Note that if the entries of the matrix are changed by something other than a specific instance of this class, for example by other code or by another instance of this class, then the text-boxes will not be updated to reflect this change.

Version:
$Revision: 1.3 $
Author:
Ben Clifford

Constructor Index

 o MatrixEditor(Matrix)
constructs a matrix editor to edit the supplied Matrix.

Method Index

 o actionPerformed(ActionEvent)
this passes on actionPerformed events (from the entry text boxes) to the current ActionListener.
 o addActionListener(ActionListener)
this adds (up to a total of one) an action listener.
 o addTextListener(TextListener)
this adds (up to a total of one) a text listener.
 o getMatrix()
returns the matrix that we are editing (not a copy).
 o textValueChanged(TextEvent)
this implements the TextListener interface.

Constructors

 o MatrixEditor
 public MatrixEditor(Matrix constructor_matrix)
constructs a matrix editor to edit the supplied Matrix.

Parameters:
constructor_matrix - the matrix to be edited.

Methods

 o getMatrix
 public Matrix getMatrix()
returns the matrix that we are editing (not a copy).

Returns:
the matrix (as supplied in the constructor)
 o textValueChanged
 public void textValueChanged(TextEvent e)
this implements the TextListener interface. During construction, the instance of MatrixEditor is set as a TextListener for all of the TextFields that hold the matrix entries. When a TextEvent is received, the matrix is immediately updated to the new value. This function does not handle exceptions thrown when the contents of the modified text field cannot be parsed as a double; instead, the exception just passes up the hierarchy.

Parameters:
e - the text event object
 o addTextListener
 public void addTextListener(TextListener l) throws TooManyListenersException
this adds (up to a total of one) a text listener. see notes for action_listener.

Throws: TooManyListenersException
if an attempt is made to add more than one TextListener.
 o actionPerformed
 public void actionPerformed(ActionEvent e)
this passes on actionPerformed events (from the entry text boxes) to the current ActionListener. see notes for action_listener.

 o addActionListener
 public void addActionListener(ActionListener l) throws TooManyListenersException
this adds (up to a total of one) an action listener. see notes for action_listener.

Throws: TooManyListenersException
if an attempt is made to add more than one ActionListener.

All Packages  Class Hierarchy  This Package  Previous  Next  Index