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.
-
electricElement(int, int, int, int)
- Sets up an electric element at a specific position and with
a specific rotation on a given grid.
-
actionPerformed(ActionEvent)
- Processes the dialog buttons.
-
checkConnection(connectionList)
- Try to connect element to the given network (in connectionList class).
-
fromString(String)
-
Reads a GRAPHICAL line to set up element.
-
genParam()
- Generates a parameter string for display.
-
itemStateChanged(ItemEvent)
- Processes any choice changes
-
paint(Graphics)
-
Can be called to allow the elements to draw them themselves.
-
rotate90()
- Set rotation of the element.
-
setLocation(int, int)
- Update the position of the element.
-
setShadow(boolean)
- Set shadow mode of the element.
-
toString()
-
Gives a GRAPHICAL line for this element.
-
toString(int)
-
Gives a SPICE line for a given instance number.
-
updateChoice(Choice)
-
This method is called when a choice in the parameter form
is changed (to do further updates).
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
setLocation
public void setLocation(int x,
int y)
- Update the position of the element.
- Parameters:
- x,y - position of the element (grid units)
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
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.
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
actionPerformed
public void actionPerformed(ActionEvent e)
- Processes the dialog buttons.
- Parameters:
- e - an AWT event
itemStateChanged
public void itemStateChanged(ItemEvent e)
- Processes any choice changes
- Parameters:
- e - an AWT event
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)
genParam
public String genParam()
- Generates a parameter string for display.
May be overwritten by a more sofisticated version.
- Returns:
- the parameter string
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
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
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
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