Class DisplayCanvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----DisplayCanvas
- public class DisplayCanvas
- extends Canvas
Class definition for a canvas for drawing an IP/ATM network.
- Version:
- $Revision: 1.7 $, $Date: 2000/10/12 14:07:48 $
- Author:
- John Cavanaugh
-
actualSize
- The actual size of the display canvas.
-
defaultCursor
- The default cursor.
-
definedSize
- The size of the display canvas desired by the applet.
-
frame
- The parent frame.
-
FRAME_MARGIN
-
-
mode
- The display mode.
-
mouseListener
- The active mouse listener.
-
net
- The IP/ATM network being displayed.
-
NEW_AREA_MODE
-
-
NORMAL_MODE
-
-
SEL_SQ_SIZE
-
-
view
- The view settings that control the display.
-
WAIT_MODE
-
-
DisplayCanvas(Dimension, VisiFrame, Network, ViewSettings)
- Constructs a display canvas.
-
clearCanvas(Graphics)
- Prepares the drawing area by clearing it to the background color.
-
frameCanvas(Graphics)
- Draws a frame around the display canvas.
-
getBandwidthString(long)
- Converts a bandwidth in cells per second to a string
giving the bandwidth in Kbps or Mbps.
-
getDisplaySize()
- Gets the size to use when drawing on the canvas.
-
getImage()
- Gets an image of the display.
-
getMode()
- Gets the display mode
-
getNetwork()
- Gets the network being displayed.
-
getTimeString(long)
- Converts a time in hundredths of a second to a string
giving days, hours, minutes, and seconds.
-
getView()
- Gets the view settings.
-
paint(Graphics)
- Paints the display canvas.
-
rectInside(Rectangle, Rectangle)
- Check whether one rectangle is inside another.
-
setMode(int)
- Sets the display mode.
-
setSizes()
- Gets the current size of the display canvas and sets the
size attributes.
-
setView(ViewSettings)
- Sets the view settings.
-
update(Graphics)
- Updates the display.
NORMAL_MODE
public static final int NORMAL_MODE
WAIT_MODE
public static final int WAIT_MODE
NEW_AREA_MODE
public static final int NEW_AREA_MODE
SEL_SQ_SIZE
public static final int SEL_SQ_SIZE
FRAME_MARGIN
public static final int FRAME_MARGIN
actualSize
private Dimension actualSize
- The actual size of the display canvas.
definedSize
private Dimension definedSize
- The size of the display canvas desired by the applet.
net
private Network net
- The IP/ATM network being displayed.
view
private ViewSettings view
- The view settings that control the display.
mode
private int mode
- The display mode.
frame
private VisiFrame frame
- The parent frame.
mouseListener
private VisiMouseListener mouseListener
- The active mouse listener.
defaultCursor
public Cursor defaultCursor
- The default cursor.
DisplayCanvas
public DisplayCanvas(Dimension definedSize,
VisiFrame frame,
Network net,
ViewSettings view)
- Constructs a display canvas.
- Parameters:
- definedSize - the size for the display canvas.
- frame - the parent frame.
- net - the network to display.
- view - the view settings.
getNetwork
public Network getNetwork()
- Gets the network being displayed.
- Returns:
- the network being displayed.
getDisplaySize
public Dimension getDisplaySize()
- Gets the size to use when drawing on the canvas.
- Returns:
- the size of the canvas.
getView
public ViewSettings getView()
- Gets the view settings.
- Returns:
- the view settings.
setView
public void setView(ViewSettings view)
- Sets the view settings.
- Parameters:
- view - the view settings.
getMode
public int getMode()
- Gets the display mode
- Returns:
- the display mode.
setMode
public void setMode(int mode)
- Sets the display mode.
- Parameters:
- mode - the new display mode.
getImage
public Image getImage()
- Gets an image of the display.
- Returns:
- an image of the display canvas.
update
public void update(Graphics g)
- Updates the display.
- Parameters:
- g - the graphics context for the display.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Paints the display canvas.
- Parameters:
- g - the graphics context for the display.
- Overrides:
- paint in class Canvas
clearCanvas
private void clearCanvas(Graphics g)
- Prepares the drawing area by clearing it to the background color.
- Parameters:
- g - the graphics context for the display.
frameCanvas
private void frameCanvas(Graphics g)
- Draws a frame around the display canvas.
- Parameters:
- g - the graphics context for the display.
setSizes
public void setSizes()
- Gets the current size of the display canvas and sets the
size attributes.
rectInside
public static boolean rectInside(Rectangle a,
Rectangle b)
- Check whether one rectangle is inside another.
- Parameters:
- a - the containing rectangle.
- b - the contained rectangle.
- Returns:
- true if A contains all four corners of B;
false otherwise.
getTimeString
public static String getTimeString(long t)
- Converts a time in hundredths of a second to a string
giving days, hours, minutes, and seconds.
- Parameters:
- t - The time interval, in hundredths of a second.
- Returns:
- A string giving the time interval in readable
units.
getBandwidthString
public static String getBandwidthString(long b)
- Converts a bandwidth in cells per second to a string
giving the bandwidth in Kbps or Mbps.
- Parameters:
- b - The bandwidth, in cells per second.
- Returns:
- A string giving the bandwidth in readable units.