我想在jgraphx中旋转一个单元格。为此,我使用了单元格样式如下:
mxCell v2 =(mxCell)graph.insertVertex(parent,null,“World!”,240,150,80,30,“rotation = 90”);
这会导致细胞旋转。但是,此单元格周围的绿框不会与单元格一起旋转:
当端口添加到单元格时,这会导致问题,因为坐标与此绿色框相关。如何将此绿色框与单元格一起旋转? 这是整个代码,这是我从jgraphx Github获得的Hello World示例。
package com.mxgraph.examples.swing;
import javax.swing.JFrame;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;
public class HelloWorld extends JFrame
{
/**
*
*/
private static final long serialVersionUID = -2707712944901661771L;
public HelloWorld()
{
super("Hello, World!");
mxGraph graph = new mxGraph();
Object parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try
{
mxCell v1 = (mxCell) graph.insertVertex(parent, null, "Hello", 20, 20, 80, 30);
mxCell v2 =(mxCell) graph.insertVertex(parent, null, "World!", 240, 150, 80, 30,"rotation=90");
graph.insertEdge(parent, null, "Edge", v1, v2);
}
finally
{
graph.getModel().endUpdate();
}
mxGraphComponent graphComponent = new mxGraphComponent(graph);
getContentPane().add(graphComponent);
}
public static void main(String[] args)
{
HelloWorld frame = new HelloWorld();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 320);
frame.setVisible(true);
}
}