Pandora
Class DrawPanel
- public class DrawPanel
- extends javax.swing.JPanel
- Given the vertices and edges of the graph, this class is responsible for painting the graph.
- Version:
- 0.1.
- Author:
- Foudalis Ilias.
DrawPanel
public DrawPanel()
- Class Constructor.
setNodes
public void setNodes(java.util.Vector nodes)
- Used to input the nodes of the graph that we want to draw.
- Parameters:
nodes
- Vector : Vector containing the nodes of the graph that are of type GraphNode.
setEdges
public void setEdges(java.util.Vector edges)
- Used to input the edges of the graph that we want to draw.
- Parameters:
edges
- Vector : Vector containing the edges of the graph that are of type GraphEdge.
setCanPaint
public void setCanPaint(boolean value)
- If value = true then the graph will be drawn.
- Parameters:
value
- boolean : If true then the draw panel can be painted.
setLastEdge
public void setLastEdge(int value)
- Sets the last edge of the graph.
- Parameters:
value
- int : The last edge.
setLastVtx
public void setLastVtx(int value)
- Sets the last vertex of the graph.
- Parameters:
value
- int : The last vertex.
setMaxDegree
public void setMaxDegree(int maxDegree)
- Sets the maximum degree of the graph that we want to draw. This variable is used to color the edges depending on their degree.
- Parameters:
maxDegree
- int : The maximum degree of the graph can be returned from getMaxDegree().
invertShowDegree
public void invertShowDegree()
- Reverses the effect of displayDegree.
invertShowDistance
public void invertShowDistance()
- Reverses the effect of displayLengthDistance.
invertShowCreationOrder
public void invertShowCreationOrder()
- Reverses the effect of displayCreationOrder.
invertRedSpots
public void invertRedSpots()
- Reverses the effect of displayRedSpots.
displayDegree
public void displayDegree(java.awt.Graphics g2d)
- Displays the degree of each node.
- Parameters:
g2d
- Graphics2D
displayLengthDistance
public void displayLengthDistance(java.awt.Graphics g2d)
- Displays the length distance ( or hop distance ) of each node.
- Parameters:
g2d
- Graphics2D
displayCreationOrder
public void displayCreationOrder(java.awt.Graphics g2d)
- Displays the creation order of each node.
- Parameters:
g2d
- Graphics2D
displayRedSpots
void displayRedSpots(java.awt.Graphics g2d)
- Displays the nodes as red spots.
- Parameters:
g2d
- Graphics2D
paintFertileNodes
void paintFertileNodes(java.awt.Graphics g2d)
- Paints the fertile nodes with black color. This option is implemented only for models that use fertility.
- Parameters:
g2d
- Graphics2D
paintComponent
public void paintComponent(java.awt.Graphics g)
- Function used to paint the graph in the Draw Panel.
- Parameters:
g
- Graphics