animation.tr
Class NetPaint
- MouseListener, MouseMotionListener
(package private) class NetPaint
extends Canvas
implements MouseMotionListener, MouseListener
class to paint the network and to handle the settings of animation
NetPaint(TokenRing s) - Constructor initializes the first two stations and sets some variables
|
COLOURS
public static final Color[] COLOURS
MAXSTATIONS
private static final int MAXSTATIONS
anz
private static int anz
buffer
private Image buffer
maxComponentHeight
public final int maxComponentHeight
maxComponentWidth
public final int maxComponentWidth
messageText
private static String messageText
monitorNode
public final Image monitorNode
normalNode
public final Image normalNode
receiveStation
private int receiveStation
selectmode
private int selectmode
sendStation
private int sendStation
sendmode
private boolean sendmode
NetPaint
public NetPaint(TokenRing s)
Constructor initializes the first two stations and sets some variables
addStation
public boolean addStation()
Puts a new station on the ring and sets the initial values
find
public int find(int x,
int y)
- >= 0 if cursor is over a station
getAnz
public int getAnz()
getMonitor
public int getMonitor()
mouseClicked
public void mouseClicked(MouseEvent e)
mouseDragged
public void mouseDragged(MouseEvent e)
mouseEntered
public void mouseEntered(MouseEvent e)
mouseExited
public void mouseExited(MouseEvent e)
mouseMoved
public void mouseMoved(MouseEvent e)
mousePressed
public void mousePressed(MouseEvent e)
mouseReleased
public void mouseReleased(MouseEvent e)
paint
public void paint(Graphics g)
Main paint routine draws all graphics
removeStation
public boolean removeStation()
Removes a station off the ring
sendestop
public void sendestop()
Stops putting data frames on the ring
sendoff
public void sendoff(int sendnr,
int recnr)
Erases the frame of sending and receiving station
sendnr
- number of sending stationrecnr
- number of receiving station
setMessageText
public void setMessageText(String text)
Prints a red colored message line in the center
setSelectMode
public void setSelectMode(int mode)
Sets what a mouse click on a station will produce
mode
- the selection mode:
- 1: sending or receiving station
- 2: station on or off
- 3: select monitor
setsend
public void setsend(boolean sm)
sm
- is true if the animation is started
startanim
public void startanim(int slt,
int ao)
Generates the tokenclass and starts the whole animation
stopanim
public void stopanim()
Stops the animation and sets the initial values
token_lives
public boolean token_lives()
- true if the whole animation is started
update
public void update(Graphics g)