// add a listener for ToolTips
vv.setVertexToolTipTransformer(new ToStringLabeller());
Container content = getContentPane();
GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
content.add(gzsp);
/**
* the regular graph mouse for the normal view
*/
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
vv.setGraphMouse(graphMouse);
vv.addKeyListener(graphMouse.getModeKeyListener());
final ScalingControl scaler = new CrossoverScalingControl();
JButton plus = new JButton("+");
plus.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scaler.scale(vv, 1.1f, vv.getCenter());
}
});
JButton minus = new JButton("-");
minus.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scaler.scale(vv, 1/1.1f, vv.getCenter());
}
});
JPanel positionPanel = new JPanel();
positionPanel.setBorder(BorderFactory.createTitledBorder("Label Position"));
JMenuBar menubar = new JMenuBar();
menubar.add(graphMouse.getModeMenu());
gzsp.setCorner(menubar);
JComboBox cb = new JComboBox();
cb.addItem(Renderer.VertexLabel.Position.N);
cb.addItem(Renderer.VertexLabel.Position.NE);
cb.addItem(Renderer.VertexLabel.Position.E);
cb.addItem(Renderer.VertexLabel.Position.SE);