當前位置: 首頁>>代碼示例>>Java>>正文


Java VisualizationViewer.setBackground方法代碼示例

本文整理匯總了Java中edu.uci.ics.jung.visualization.VisualizationViewer.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java VisualizationViewer.setBackground方法的具體用法?Java VisualizationViewer.setBackground怎麽用?Java VisualizationViewer.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.uci.ics.jung.visualization.VisualizationViewer的用法示例。


在下文中一共展示了VisualizationViewer.setBackground方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpView

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的package包/類
private void setUpView(Graph graph)
    {                 
//        layout = new SpringLayout2(graph);
        layout = new KKLayout(graph);
        //layout.setSize(new Dimension(700,700));
        vv = new VisualizationViewer(layout);
        vv.setPreferredSize(new Dimension(900,900));
        vv.setBackground( Color.white );
        // Tell the renderer to use our own customized label rendering
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
        vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
        getContentPane().add(new GraphZoomScrollPane(vv), BorderLayout.CENTER);

        /*Mouse controller plugins*/
        PluggableGraphMouse gm = new PluggableGraphMouse();
        gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK));
        gm.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1.1f, 0.9f));
        gm.add(new PickingGraphMousePlugin());
        vv.setGraphMouse(gm);
    }
 
開發者ID:sinantie,項目名稱:Generator,代碼行數:22,代碼來源:VisualiseHypergraph.java

示例2: GraphRenderer

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的package包/類
/**
 * Full constructor
 * 
 * @param graph
 *            The graph to render
 * @param layout
 *            The layout to use
 */
public GraphRenderer(Graph<V, E> graph, Layout<V, E> layout) {
	this.graph = graph;
	this.setBackground(Color.WHITE);
	layout.setSize(new Dimension(1680, 1050));

	final VisualizationViewer<V, E> viewer = new VisualizationViewer<V, E>(
			layout);
	viewer.setBackground(Color.WHITE);
	viewer.getRenderContext().setVertexDrawPaintTransformer(
			new BlackVertexDrawPaintFunction<V>());
	viewer.getRenderContext().setVertexFillPaintTransformer(
			new HighlightingVertexFillPaintFunction<V>());
	viewer.getRenderContext().setEdgeDrawPaintTransformer(
			new HighlightingEdgePaintFunction());
	viewer.getRenderContext().setEdgeStrokeTransformer(
			new HighlightingEdgeStrokeFunction());
	viewer.getRenderContext().setVertexLabelTransformer(
			new ToStringLabeller<V>());
	viewer.setGraphMouse(new DefaultModalGraphMouse<V, E>());

	this.setLayout(new BorderLayout());
	this.add(viewer, BorderLayout.CENTER);
}
 
開發者ID:markuskorbel,項目名稱:adt.reference,代碼行數:32,代碼來源:GraphRenderer.java

示例3: initGraph

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的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);
	}
}
 
開發者ID:markkohdev,項目名稱:oStorybook,代碼行數:33,代碼來源:MemoriaPanel.java

示例4: startFunction

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的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;
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:64,代碼來源:PluggableRendererDemo.java

示例5: ShortestPathDemo

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的package包/類
public ShortestPathDemo() {

	this.mGraph = getGraph();
	setBackground(Color.WHITE);
	// show graph
       final Layout<String,Number> layout = new FRLayout<String,Number>(mGraph);
       final VisualizationViewer<String,Number> vv = new VisualizationViewer<String,Number>(layout);
       vv.setBackground(Color.WHITE);

       vv.getRenderContext().setVertexDrawPaintTransformer(new MyVertexDrawPaintFunction<String>());
       vv.getRenderContext().setVertexFillPaintTransformer(new MyVertexFillPaintFunction<String>());
       vv.getRenderContext().setEdgeDrawPaintTransformer(new MyEdgePaintFunction());
       vv.getRenderContext().setEdgeStrokeTransformer(new MyEdgeStrokeFunction());
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
       vv.setGraphMouse(new DefaultModalGraphMouse<String, Number>());
       vv.addPostRenderPaintable(new VisualizationViewer.Paintable(){
           
           public boolean useTransform() {
               return true;
           }
           public void paint(Graphics g) {
               if(mPred == null) return;
               
               // for all edges, paint edges that are in shortest path
               for (Number e : layout.getGraph().getEdges()) {
                   
                   if(isBlessed(e)) {
                       String v1 = mGraph.getEndpoints(e).getFirst();
                       String v2 = mGraph.getEndpoints(e).getSecond();
                       Point2D p1 = layout.transform(v1);
                       Point2D p2 = layout.transform(v2);
                       p1 = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, p1);
                       p2 = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, p2);
                       Renderer<String,Number> renderer = vv.getRenderer();
                       renderer.renderEdge(
                               vv.getRenderContext(),
                               layout,
                               e);
                   }
               }
           }
       });
       
       setLayout(new BorderLayout());
       add(vv, BorderLayout.CENTER);
       // set up controls
       add(setUpControls(), BorderLayout.SOUTH);
}
 
開發者ID:marcvanzee,項目名稱:mdp-plan-revision,代碼行數:49,代碼來源:ShortestPathDemo.java


注:本文中的edu.uci.ics.jung.visualization.VisualizationViewer.setBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。