当前位置: 首页>>代码示例>>Java>>正文


Java JGraphXAdapter.setEdgeLabelsMovable方法代码示例

本文整理汇总了Java中org.jgrapht.ext.JGraphXAdapter.setEdgeLabelsMovable方法的典型用法代码示例。如果您正苦于以下问题:Java JGraphXAdapter.setEdgeLabelsMovable方法的具体用法?Java JGraphXAdapter.setEdgeLabelsMovable怎么用?Java JGraphXAdapter.setEdgeLabelsMovable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgrapht.ext.JGraphXAdapter的用法示例。


在下文中一共展示了JGraphXAdapter.setEdgeLabelsMovable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveGraph

import org.jgrapht.ext.JGraphXAdapter; //导入方法依赖的package包/类
private void saveGraph(UndirectedGraph<TupleWithTable, DefaultEdge> instancesGraph) {
        JGraphXAdapter<TupleWithTable, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<TupleWithTable, DefaultEdge>(instancesGraph);
        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1");
        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0");
        jgxAdapterContext.setCellsEditable(false);
        jgxAdapterContext.setCellsMovable(false);
        jgxAdapterContext.setEdgeLabelsMovable(false);
        jgxAdapterContext.setCellsDeletable(false);
        jgxAdapterContext.setCellsDisconnectable(false);
        jgxAdapterContext.setCellsResizable(false);
        jgxAdapterContext.setCellsBendable(false);
        JFrame frame = new JFrame();
        mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext);
        frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER);
        mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext);
        layout.execute(jgxAdapterContext.getDefaultParent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Graph");
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        try {
            while (true) {
                Thread.sleep(500);
            }
        } catch (InterruptedException ex) {
            java.util.logging.Logger.getLogger(ComputeInstanceSimilarityBlock.class.getName()).log(Level.SEVERE, null, ex);
        }
//        try {
//            BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null);
//            ImageIO.write(image, "PNG", new File("/Temp/bart/similarity/instances-graph.png"));
//        } catch (IOException ex) {
//            logger.error("Unable to save graph image: " + ex.getLocalizedMessage());
//        }
    }
 
开发者ID:dbunibas,项目名称:BART,代码行数:36,代码来源:ComputeInstanceSimilarityBlock.java

示例2: showTGDGraph

import org.jgrapht.ext.JGraphXAdapter; //导入方法依赖的package包/类
private void showTGDGraph(DirectedGraph<TGDStratum, DefaultEdge> strataGraph) {
        JGraphXAdapter<TGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<TGDStratum, DefaultEdge>(strataGraph);
        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1");
//        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0");
        jgxAdapterContext.setCellsEditable(false);
        jgxAdapterContext.setCellsMovable(false);
        jgxAdapterContext.setEdgeLabelsMovable(false);
        jgxAdapterContext.setCellsDeletable(false);
        jgxAdapterContext.setCellsDisconnectable(false);
        jgxAdapterContext.setCellsResizable(false);
        jgxAdapterContext.setCellsBendable(false);
        JFrame frame = new JFrame();
        mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext);
        frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER);
        mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext);
        layout.execute(jgxAdapterContext.getDefaultParent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Graph");
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        try {
            BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null);
            ImageIO.write(image, "PNG", new File("/Temp/llunatic/tgd-graph.png"));
        } catch (IOException ex) {
            logger.error("Unable to save graph image: " + ex.getLocalizedMessage());
        }
    }
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:29,代码来源:TTGDStratification.java

示例3: showEGDGraph

import org.jgrapht.ext.JGraphXAdapter; //导入方法依赖的package包/类
private void showEGDGraph(DirectedGraph<EGDStratum, DefaultEdge> strataGraph) {
        JGraphXAdapter<EGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<EGDStratum, DefaultEdge>(strataGraph);
        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1");
//        jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0");
        jgxAdapterContext.setCellsEditable(false);
        jgxAdapterContext.setCellsMovable(false);
        jgxAdapterContext.setEdgeLabelsMovable(false);
        jgxAdapterContext.setCellsDeletable(false);
        jgxAdapterContext.setCellsDisconnectable(false);
        jgxAdapterContext.setCellsResizable(false);
        jgxAdapterContext.setCellsBendable(false);
        JFrame frame = new JFrame();
        mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext);
        frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER);
        mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext);
        layout.execute(jgxAdapterContext.getDefaultParent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Graph");
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        try {
            BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null);
            ImageIO.write(image, "PNG", new File("/Temp/llunatic/egd-graph.png"));
        } catch (IOException ex) {
            logger.error("Unable to save graph image: " + ex.getLocalizedMessage());
        }
    }
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:29,代码来源:TTGDStratification.java

示例4: JGraphXGraphPanel

import org.jgrapht.ext.JGraphXAdapter; //导入方法依赖的package包/类
public JGraphXGraphPanel(NAR n) {
    super(new BorderLayout());

    
    NARGraph g = new NARGraph();
    g.add(n, IncludeEverything, new NARGraph.DefaultGraphizer(true,true,true,true,true));        

    // create a visualization using JGraph, via an adapter
    jgxAdapter = new JGraphXAdapter(g) {


      
    };
    

    mxGraphComponent mxc = new mxGraphComponent(jgxAdapter) {
        
    };
    mxc.setAntiAlias(true);
    mxc.setConnectable(false);
    mxc.setExportEnabled(false);
    mxc.setFoldingEnabled(false);
    mxc.setPanning(true);
    mxc.setTextAntiAlias(true);

    
    add(new JScrollPane(mxc), BorderLayout.CENTER);


    
    mxFastOrganicLayout layout = 
            //new mxCompactTreeLayout(jgxAdapter);
            new mxFastOrganicLayout(jgxAdapter);
            //new mxCircleLayout(jgxAdapter);        
    layout.setForceConstant(150);
    layout.execute(jgxAdapter.getDefaultParent());
    

    /*
    mxOrganicLayout layout = 
            //new mxCompactTreeLayout(jgxAdapter);
            new mxOrganicLayout(jgxAdapter);
            //new mxCircleLayout(jgxAdapter);        
    layout.setEdgeLengthCostFactor(0.001);*/
    
    
    /*
    mxCompactTreeLayout layout = 
            new mxCompactTreeLayout(jgxAdapter);
    
    layout.setLevelDistance(40);
    layout.setNodeDistance(50);
    layout.execute(jgxAdapter.getDefaultParent());*/
    
    
    jgxAdapter.setConnectableEdges(false);
    jgxAdapter.setCellsDisconnectable(false);
    jgxAdapter.setEdgeLabelsMovable(false);
    //jgxAdapter.setCellsLocked(true);
}
 
开发者ID:automenta,项目名称:opennars,代码行数:61,代码来源:JGraphXGraphPanel.java


注:本文中的org.jgrapht.ext.JGraphXAdapter.setEdgeLabelsMovable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。