图表缩放ScrollPane和Visualization Viewer依赖项

时间:2011-09-14 05:38:02

标签: java swing visualization jung

在我的GraphZoomScrollPane工作得很好的情况下,我感到非常震惊,在一些放大和缩小操作后,滚动条突然消失。他们确实来了bak但是尺寸不合适而没有Y?任何人都可以在这方面帮助我,让我知道缩放所依赖的参数是什么?我正在使用JUNG PopupGraphMousePluginModalGraphMouseDefaultSettableVertexLocationFunctionEdgeWeightStrokeFunction。 非常感谢任何形式的文档或帮助。

1 个答案:

答案 0 :(得分:0)

private JPanel _getCenterPanel() {
        JPanel jpMainPanel = new com.panduit.acmnms.gui.framework.ACMPanel(new GridLayout(1,0));
        initVisualViewer();
        pane = new GraphZoomScrollPane(vv);//Defined in the begng.
        jpMainPanel.add(pane);
        return jpMainPanel;
    }

private void initVisualViewer() {
        clusteringLayout = new SubLayoutDecorator(new SpringLayout(graph));
        Dimension preferredSize = new Dimension(width, height);
        visualizationModel = new DefaultVisualizationModel(clusteringLayout, preferredSize);
        vv =  new VisualizationViewer(visualizationModel, pr, preferredSize);
        ewcs = new EdgeWeightStrokeFunction(edge_weight);
        vertexLocations = new DefaultSettableVertexLocationFunction(); 
        vv.setDoubleBuffered(false);
        vv.setGraphMouse(graphMouse);
        graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
        popupGraphMousePlugin = new PopupGraphMousePlugin(vertexLocations);
        graphMouse.add(popupGraphMousePlugin);
        System.out.println("  graphMouse.getModeMenu()  "+graphMouse.getModeMenu());
        graphMouse.setZoomAtMouse(true);
        vv.setGraphMouse(graphMouse);
        vertexImagerAndShapeFunction = new VertexIconAndShapeFunction(new EllipseVertexShapeFunction());
        vertexImagerAndShapeFunction.setIconMap(iconMap);
        pr.setVertexIconFunction(vertexImagerAndShapeFunction);
        pr.setVertexShapeFunction(vertexImagerAndShapeFunction);
        vertexStringerImpl = new VertexStringerImpl(labelMap);
        pr.setVertexStringer(vertexStringerImpl);
        vertexToolTipFunctionAdapter = new VertexToolTipFunctionAdapter(tooTipMap);
        vv.setToolTipFunction(vertexToolTipFunctionAdapter);
        vv.setPickSupport(new ShapePickSupport());
            pr.setEdgeShapeFunction(new EdgeShape.QuadCurve());
        ewcs.setWeighted(true);
        vv.setBackground(Color.white);
    }

以上是代码的一部分,负责缩放部分代码。 请让我知道。哪里错了。