diff --git a/src/java/com/threerings/nodemap/NodeMapPanel.java b/src/java/com/threerings/nodemap/NodeMapPanel.java index d46a1e6ff..5c18fbc1c 100644 --- a/src/java/com/threerings/nodemap/NodeMapPanel.java +++ b/src/java/com/threerings/nodemap/NodeMapPanel.java @@ -1,5 +1,5 @@ // -// $Id: NodeMapPanel.java,v 1.3 2001/08/28 23:50:45 shaper Exp $ +// $Id: NodeMapPanel.java,v 1.4 2001/09/28 00:46:54 shaper Exp $ package com.threerings.nodemap; @@ -12,22 +12,53 @@ import com.samskivert.swing.ToolTipObserver; import com.samskivert.swing.ToolTipProvider; /** - * The node map panel handles display of a node map and passes Swing - * UI events on to the appropriate node map event handling methods. + * The node map panel handles display of a node map and passes user + * interface events on to the appropriate node map event handling + * methods. */ public class NodeMapPanel extends JPanel implements MouseListener, MouseMotionListener, ToolTipObserver { + /** + * Construct a node map panel. + */ + public NodeMapPanel () + { + init(); + } + + /** + * Construct a node map panel that displays the given node map. + * + * @param map the node map to display. + */ public NodeMapPanel (NodeMap map) + { + init(); + setNodeMap(map); + } + + /** + * Initialize the node map panel. + */ + protected void init () + { + // listen to our mouse events + addMouseListener(this); + addMouseMotionListener(this); + } + + /** + * Set the node map displayed by this panel. + * + * @param map the node map to display. + */ + public void setNodeMap (NodeMap map) { _map = map; // create the tool tip manager and inform the node map _map.setToolTipManager(new ToolTipManager(this)); - - // listen to our mouse events - addMouseListener(this); - addMouseMotionListener(this); } public void paintComponent (Graphics g) diff --git a/src/java/com/threerings/nodemap/direction/DirectionalLayoutManager.java b/src/java/com/threerings/nodemap/direction/DirectionalLayoutManager.java index bdf4f291f..a56a4ff55 100644 --- a/src/java/com/threerings/nodemap/direction/DirectionalLayoutManager.java +++ b/src/java/com/threerings/nodemap/direction/DirectionalLayoutManager.java @@ -1,5 +1,5 @@ // -// $Id: DirectionalLayoutManager.java,v 1.2 2001/08/23 23:44:12 shaper Exp $ +// $Id: DirectionalLayoutManager.java,v 1.3 2001/09/28 00:46:54 shaper Exp $ package com.threerings.nodemap.direction; @@ -10,11 +10,17 @@ import com.threerings.nodemap.*; /** * The directional layout manager lays nodes out according to the * eight cardinal directions as specified in the {@link Directions} - * class. The nodes must be connected with {@link DirectionalEdge} - * edges. + * class. The nodes must be fully connected in both directions with + * {@link DirectionalEdge} edges. */ public class DirectionalLayoutManager implements LayoutManager { + /** + * Construct a directional layout manager that lays out nodes + * connected by edges that are edgelen pixels long. + * + * @param edgelen the length of the edges in pixels. + */ public DirectionalLayoutManager (int edgelen) { _edgelen = edgelen;