本文整理汇总了Java中edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse.add方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultModalGraphMouse.add方法的具体用法?Java DefaultModalGraphMouse.add怎么用?Java DefaultModalGraphMouse.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse
的用法示例。
在下文中一共展示了DefaultModalGraphMouse.add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGraph
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void initGraph() {
try {
labelMap = new HashMap();
iconMap = new HashMap();
graph = new DelegateForest();
treeLayout = new TreeLayout(graph);
balloonLayout = new BalloonLayout(graph);
vv = new VisualizationViewer(balloonLayout);
vv.setSize(new Dimension(800, 800));
refreshGraph();
vv.setBackground(Color.white);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.setVertexToolTipTransformer(new EntityTransformer());
graphPanel = new GraphZoomScrollPane(vv);
DefaultModalGraphMouse mouse = new DefaultModalGraphMouse();
vv.setGraphMouse(mouse);
mouse.add(new MemoriaGraphMouse(this));
// T O D O MemoriaPanel compile error suppress 2 lines
//VertexStringerImpl localVertexStringerImpl = new VertexStringerImpl(/*this.labelMap*/);
//this.vv.getRenderContext().setVertexLabelTransformer(new VertexStringerImpl(/*localVertexStringerImpl*/));
VertexIconShapeTransformer transformer = new VertexIconShapeTransformer(new EllipseVertexShapeTransformer());
DefaultVertexIconTransformer iconTransformer = new DefaultVertexIconTransformer();
transformer.setIconMap(iconMap);
iconTransformer.setIconMap(iconMap);
vv.getRenderContext().setVertexShapeTransformer(transformer);
vv.getRenderContext().setVertexIconTransformer(iconTransformer);
} catch (Exception exc) {
SbApp.error("MemoriaPanel.initGraph()",exc);
}
}
示例2: startFunction
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public JPanel startFunction() {
Graph g = getGraph();
pr = new PluggableRenderer();
Layout layout = new FRLayout(g);
vv = new VisualizationViewer(layout, pr);
// add Shape based pick support
vv.setPickSupport(new ShapePickSupport());
PickedState picked_state = vv.getPickedState();
affineTransformer = vv.getLayoutTransformer();
// create decorators
vcf = new SeedColor(picked_state);
ewcs =
new EdgeWeightStrokeFunction(edge_weight);
vsh = new VertexStrokeHighlight(picked_state);
ff = new FontHandler();
vs_none = new ConstantVertexStringer(null);
es_none = new ConstantEdgeStringer(null);
vssa = new VertexShapeSizeAspect(voltages);
show_edge = new DirectionDisplayPredicate(true, true);
show_arrow = new DirectionDisplayPredicate(true, false);
show_vertex = new VertexDisplayPredicate(false);
// uses a gradient edge if unpicked, otherwise uses picked selection
edgePaint = new GradientPickedEdgePaintFunction( new PickableEdgePaintFunction(picked_state,Color.black,Color.cyan),
vv, vv, picked_state);
pr.setVertexPaintFunction(vcf);
pr.setVertexStrokeFunction(vsh);
pr.setVertexStringer(vs_none);
pr.setVertexFontFunction(ff);
pr.setVertexShapeFunction(vssa);
pr.setVertexIncludePredicate(show_vertex);
pr.setEdgePaintFunction( edgePaint );
pr.setEdgeStringer(es_none);
pr.setEdgeFontFunction(ff);
pr.setEdgeStrokeFunction(ewcs);
pr.setEdgeIncludePredicate(show_edge);
pr.setEdgeShapeFunction(new EdgeShape.Line());
pr.setEdgeArrowPredicate(show_arrow);
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
vv.setBackground(Color.white);
GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
jp.add(scrollPane);
gm = new DefaultModalGraphMouse();
vv.setGraphMouse(gm);
gm.add(new PopupGraphMousePlugin());
addBottomControls( jp );
vssa.setScaling(true);
vv.setToolTipFunction(new VoltageTips());
vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");
return jp;
}