All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jschem.electricElement

java.lang.Object
   |
   +----jschem.electricElement

public class electricElement
extends Object
implements ActionListener, ItemListener
Base class for all electric elements. It keeps the data of shape and parameter (values). It has also the neccessary methods to generate a line for the netlist and the data for a preload file. Every "real" electrical element inherits this class and overwrites at least the resetShape method to setup an own parameter/shape data set.


Constructor Index

 o electricElement(int, int, int, int)
Sets up an electric element at a specific position and with a specific rotation on a given grid.

Method Index

 o actionPerformed(ActionEvent)
Processes the dialog buttons.
 o checkConnection(connectionList)
Try to connect element to the given network (in connectionList class).
 o fromString(String)
Reads a GRAPHICAL line to set up element.
 o genParam()
Generates a parameter string for display.
 o itemStateChanged(ItemEvent)
Processes any choice changes
 o paint(Graphics)
Can be called to allow the elements to draw them themselves.
 o rotate90()
Set rotation of the element.
 o setLocation(int, int)
Update the position of the element.
 o setShadow(boolean)
Set shadow mode of the element.
 o toString()
Gives a GRAPHICAL line for this element.
 o toString(int)
Gives a SPICE line for a given instance number.
 o updateChoice(Choice)
This method is called when a choice in the parameter form is changed (to do further updates).

Constructors

 o electricElement
 public electricElement(int x,
                        int y,
                        int gr,
                        int r)
Sets up an electric element at a specific position and with a specific rotation on a given grid.

Parameters:
x,y - initial position of the element (grid units)
r - initial rotation of the element
gr - grid to be used

Methods

 o setLocation
 public void setLocation(int x,
                         int y)
Update the position of the element.

Parameters:
x,y - position of the element (grid units)
 o setShadow
 public void setShadow(boolean val)
Set shadow mode of the element. This mode may be used when the element is about to be placed and is therefore not fully instanciated.

Parameters:
val - set to true if element is partially placed
 o rotate90
 public void rotate90()
Set rotation of the element. Each call rotates by 90 degrees, we rotate the props data directly, this makes redraw very fast.

 o updateChoice
 public void updateChoice(Choice choice)
This method is called when a choice in the parameter form is changed (to do further updates).

Parameters:
chouce - the Choice object which was changed
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Processes the dialog buttons.

Parameters:
e - an AWT event
 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Processes any choice changes

Parameters:
e - an AWT event
 o checkConnection
 public void checkConnection(connectionList conns)
Try to connect element to the given network (in connectionList class).

Parameters:
conns - a given network (of several nets)
 o genParam
 public String genParam()
Generates a parameter string for display. May be overwritten by a more sofisticated version.

Returns:
the parameter string
 o paint
 public void paint(Graphics g)
Can be called to allow the elements to draw them themselves. It draws the shapes in green, connected pins blue and unconnected pins in red. Additionally the net names of the pins (if available) are printed.

Parameters:
g - Graphics context to draw to
 o fromString
 public boolean fromString(String s)
Reads a GRAPHICAL line to set up element. May be overwritten by a more sofisticated version.

Returns:
true if read in was successful
 o toString
 public String toString()
Gives a GRAPHICAL line for this element. We just use '(', ')' and ' ' as separator. May be overwritten by a more sofisticated version.

Returns:
a graphical definition line
Overrides:
toString in class Object
 o toString
 public String toString(int inst)
Gives a SPICE line for a given instance number. May be overwritten by a more sofisticated version.

Parameters:
inst - number of this instance.
Returns:
a SPICE conform netlist line

All Packages  Class Hierarchy  This Package  Previous  Next  Index