1) DrawingPanel class; Sub-class of JPanel for drawing (JLabels as node and line as links). Nodes are added and linked dynamically.
2) DrawingPanelMouseListener subclasses MouseInputAdapter.
3) Node class extends JLabel. It maintains list of adjacent neighbors to draw line between nodes along with utility data elements.
4) MainPanel extends JPanel. It adds JScrollPanel(drawingPanel) in border layout center and one toolbar is added at north.
5) AppFrame is main class which display GUI
Problem: Inside un-scrolled area, every thing works fine. New nodes created, line is drawn between two nodes, when node dragged corresponding link also redrawn accurately. But when one node taken beyond display area and left/right scroller appears, then link shifts from both src and dst node. It seems calculation for line end points disturbed with new scrolled area. The far I drag that node, line shifts from src(or dest) node proportionately. When that node taken back to normal display area, link connect both nodes in proper point. Might be some viewport issue.
Hope you could figure out my design. Please let me know if further code need to be shown.
[ January 01, 2009: Message edited by: Rob Prime ]