您用的是JUNG包构建网络么?& M: g6 s" R+ y5 r, N
JUNG中可视化设置:
8 p4 }4 F; c, t2 e5 O' P$ S//1. 初始化一个图g----(例如:Graph<V,E> g=new SparseGraph<V,E>(); 9 f% d) J3 ?, ^3 W9 y& y; W) M
//2. 书写节点&连线添加规则(应该就是楼大自己构建的网络). ^9 u, G! l% e3 Y( t
//3 创建布局管理器( @8 Z2 p* ^( c# _
Layout<V,E> layout = new KKLayout(g);(这只是其中一种布局方式,具体的楼大请见api) ^& l1 q* q/ E( l# G- b
//4. 添加面板类BasicVisualizationServer
( M* B& L# M. \" B; _7 @ BasicVisualizationServer<V,E> vv = new BasicVisualizationServer<V,E>(layout);
6 ^! Y. M( s1 l//5. 将上述对象放置在一个JFrame框架中并显示之
( Z6 k# L+ R+ j( L# k& V3 `. \ frame.getContentPane().add(vv);
: f7 n( g. P+ s frame.pack();# C" R( m% z* m
frame.setVisible(true);
5 e' Y' k# ~0 q, Q @% S+ d' t# y1 q( f- A' j" v
希望对您有用…… |