0
我无法弄清楚如何为我的jrame放置滚动条,还是应该尝试放入jgraph内?我尝试了不同的东西,但它不是编译或不显示,或者它覆盖了图表?Java jframe jgraph滚动平面
主要的Java
final GraphMain applet=new GraphMain(file);
applet.init();
JFrame f=new JFrame("Title goes here");
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
applet.stop();
applet.destroy();
System.exit(0);
}
});
f.setLayout(new BorderLayout());
f.add(applet, BorderLayout.CENTER);
f.setSize(DEFAULT_SIZE1);
applet.start();
f.setVisible(true);
jgraph扩展JApplet的
// create a JGraphT graph
UndirectedGraph<String, DefaultEdge> g =
new ListenableUndirectedGraph<String, DefaultEdge>(DefaultEdge.class);
// create a visualization using JGraph, via an adapter
m_jgAdapter = new JGraphModelAdapter<String, DefaultEdge>(g);
JGraph jgraph = new JGraph(m_jgAdapter);
adjustDisplaySettings(jgraph);
getContentPane().add(jgraph);
resize(DEFAULT_SIZE);
/* scrollbar = new Scrollbar(Scrollbar.HORIZONTAL, 50, 0, 0, 100);
add(scrollbar);*/
/* scrollbar = new Scrollbar(Scrollbar.HORIZONTAL, 50, 0, 0, 100);
add(scrollbar);
scrollbar.addAdjustmentListener(this);
*/
我会在哪里执行此操作?在主要还是jgraph?好吧,我已经在图形扩展小程序中工作了。谢谢。 – MAXGEN