本文整理汇总了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());
// }
}
示例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());
}
}
示例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());
}
}
示例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);
}