Class SubPopGraph

Class SubPopGraph

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----SubPopGraph

public class SubPopGraph
extends Panel
This class is responsible for generating a visual representation of the sub-population exchanges. It uses double buffering and all that other cool stuff.....
See Also:
SubPopFrame

Variable Index

 o exchanges
 o graphHeight
 o graphWidth
 o radius

Constructor Index

 o SubPopGraph(SubPopFrame, int)
Initialize instance variables and resize the panel

Method Index

 o backgroundPaint(Graphics)
The method that actually does all of the drawing.
 o minimumSize()
Calculate the minimum size of the panel
 o paint(Graphics)
The overridden paint method responsible for figuring out if we are double-buffered or not and then dispatching the drawing
 o preferredSize()
Calculate the preferred size of the panel
 o refreshGraph(Exchange[])
After accepting a new set of exchanges, redraw the sub pop graph

Variables

 o graphWidth
  public final static int graphWidth
 o graphHeight
  public final static int graphHeight
 o radius
  public final static int radius
 o exchanges
  public Exchange exchanges[]

Constructors

 o SubPopGraph
  public SubPopGraph(SubPopFrame spf,
                     int n)
Initialize instance variables and resize the panel
Parameters:
spf - a reference to the SubPopFrame that created me
n - the number of sub populations

Methods

 o refreshGraph
  public void refreshGraph(Exchange exArray[])
After accepting a new set of exchanges, redraw the sub pop graph
Parameters:
exArray - an array of Exchange objects
 o backgroundPaint
  public void backgroundPaint(Graphics g)
The method that actually does all of the drawing. It paints the background, then the exchange links, the link arrowheads, and finally the sub pops.
Parameters:
g - the graphics object
 o paint
  public void paint(Graphics g)
The overridden paint method responsible for figuring out if we are double-buffered or not and then dispatching the drawing
Parameters:
g - the graphics object
Overrides:
paint in class Component
 o minimumSize
  public Dimension minimumSize()
Calculate the minimum size of the panel
Returns:
the dimensions of the graph
Overrides:
minimumSize in class Container
 o preferredSize
  public Dimension preferredSize()
Calculate the preferred size of the panel
Returns:
the minimum size of the panel
Overrides:
preferredSize in class Container