jgraphx

JGraphx : How to avoid adding edges over each other?

走远了吗. 提交于 2019-12-12 10:24:01
问题 I'm working on an application using jGraphx and I want to know how to avoid creating edges over each other. When I add 2 edges between 2 vetexes, the 2 edges are above eatch other.. Thanks in advance. EDIT : That's what I get, those are 2 edges with the labels : "dist = 1" and "dist = 4" above each other. 回答1: It can be done easily: new mxCircleLayout(graph).execute(graph.getDefaultParent()); new mxParallelEdgeLayout(graph).execute(graph.getDefaultParent()); 回答2: Without seeing any of your

JGraphX - change edge rooting style

杀马特。学长 韩版系。学妹 提交于 2019-12-11 11:06:06
问题 I am using eclipse as editor and jgraphx v1.1. I am trying to change the edge style to sidetoside. For some reason I keep getting errors in setStyle. I have also tried edgeStyle[mxConstants.STYLE_EDGE] = mxEdgeStyle.SideToSide but still nothing. Any ideas what I do wrong? Thanks in advance public Design() { super("Path Followed"); AAA aaa = new AAA() ; mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); Object edgeStyle = graph.getStylesheet().getDefaultEdgeStyle() ;

Jgraph in JavaFx

*爱你&永不变心* 提交于 2019-12-11 07:46:52
问题 Is it possible to use jgraphx with JavaFx 2.0? I have tried using the below code, but i could not add the graph component to the JavaFx component. mxGraph graph = new mxGraph(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { Object v1 = graph.insertVertex(parent, null, "Hello", 20, 20, 80, 30); Object v2 = graph.insertVertex(parent, null, "World!", 240, 150, 80, 30); graph.insertEdge(parent, null, "Edge", v1, v2); } finally { graph.getModel().endUpdate(); }

Vertex labels painting outside of vertex, over scrollbars and onto other components when setLabelsClipped is true

隐身守侯 提交于 2019-12-11 02:47:48
问题 I've been working with JGraph for a while and it appears there is a painting issue when you set label clipping to true: The following boiled-down example shows the problem in a living application that you can mess with: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTextArea; import

XML to graph by JGraphX API

試著忘記壹切 提交于 2019-12-11 00:15:25
问题 I need to parse XML to a graph in JGraphX using Java. I get this XML from the JGraphX library and need to again set a graph by this XML. Is there any JGraphX library method that converts XML to a graph? I have this this below code to get XML from a graph: try { System.out.println("call xml getting code"); mxCodec codec = new mxCodec(); String xml = mxUtils.getXml(codec.encode(graph1.getModel())); java.io.FileWriter fw = new java.io.FileWriter("E:\\my-file.xml"); fw.write(xml); fw.close(); }

JGraphX - Custom Layoult - Curved Edges

强颜欢笑 提交于 2019-12-08 08:12:56
问题 I'm trying to customize a layout of jGraph. i Want to create curve edges, but I have a problem. Every time i create a group of vertex on JGraph, and I firing an event to update this graph, the edge is missing points compared to the previous state. Here is a exemple: http://i.stack.imgur.com/QrQIL.png Can someone help me? any idea? Here my codes: class CurveGraphView extends mxGraphView { public CurveGraphView(mxGraph graph) { super(graph); } /* Only override this if you want the label to

How to make the edges of needed form in jgraphx's graph?

蓝咒 提交于 2019-12-06 07:25:14
My graph contains rectangular vertices with single outgoing edge and the vertices of rhombus shape with two outgoing edges. I'm using mxCompactTreeLayout and mostly everything is ok except that edges of the vertices of the second type look wrong for me. I want them to look like in the picture Instead, edges connected to the bottom segments of the rhombus. What should I do to get edges look as desired. EDIT: Added source code. PtNodeVertex.java package org.jsc.core.visualization.jgraphx; import com.mxgraph.model.mxCell; import com.mxgraph.model.mxGeometry; import com.mxgraph.util.mxPoint;

Undirected Graphs in JGraphX

北战南征 提交于 2019-12-06 04:12:48
I try to show graphs in JGraphx. Everything is fine as long as I use directed Graphs, but when I try to show an undirected one, its shown with direction. The code is from the demo of jgrapht. package org.jgrapht.demo; import com.mxgraph.layout.*; import com.mxgraph.swing.*; import java.awt.*; import java.nio.file.FileSystem; import javax.swing.*; import org.jgrapht.*; import org.jgrapht.ext.*; import org.jgrapht.graph.*; /** * A demo applet that shows how to use JGraphX to visualize JGraphT graphs. * Applet based on JGraphAdapterDemo. * * @since July 9, 2013 */ public class JGraphXAdapterDemo

mxHierarchicalLayout not working as expected

戏子无情 提交于 2019-12-05 23:33:07
I'm using JGraphx to draw a graph inside a Swing Panel and all works fine. I try to insert two cells inside a target cell and is working, but layout is changing and all cells are not horizontal. So my example is: 1) build a graph with some cells: 2) press top botton and add two cells inside Hello: As you can see, problem is layout is not horizontal anymore, even if I call again mxHierarchicalLayout. Thanks for answers! package com.mxgraph.examples.swing; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java