我使用SpringLayout2进行图形可视化。我添加了Jbutton以通过单击此按钮来更改布局。如何做到这一点?我可以用LayoutTransition吗?我尝试了以下代码。
JButton layout1 = new JButton("Layout");
layout1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
LayoutTransition<String, Edge> lt = new LayoutTransition<String, Edge>(
vv, layout, radialLayout);
Animator animator = new Animator(lt);
animator.start();
vv.setGraphLayout(new StaticLayout(layout.getGraph(), layout));
vv.repaint();
}
});
但是我收到错误&#34;显示控制台视图遇到问题&#34; 。任何人都可以帮助我