vv2.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<String>(vv2.getPickedVertexState(), Color.red, Color.yellow));
vv1.getRenderer().setVertexRenderer(new GradientVertexRenderer<String,Number>(Color.red, Color.white, true));
vv1.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv1.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
ScalingControl vv2Scaler = new CrossoverScalingControl();
vv2.scaleToLayout(vv2Scaler);
viewGrid = new ViewGrid(vv2, vv1);
// add default listener for ToolTips
vv1.setVertexToolTipTransformer(new ToStringLabeller());
vv2.setVertexToolTipTransformer(new ToStringLabeller());
vv2.getRenderContext().setVertexLabelTransformer(vv1.getRenderContext().getVertexLabelTransformer());
ToolTipManager.sharedInstance().setDismissDelay(10000);
Container content = getContentPane();
Container panel = new JPanel(new BorderLayout());
Container rightPanel = new JPanel(new GridLayout(2,1));
GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv1);
panel.add(gzsp);
rightPanel.add(new JPanel());
rightPanel.add(vv2);
panel.add(rightPanel, BorderLayout.EAST);
helpDialog = new JDialog();
helpDialog.getContentPane().add(new JLabel(instructions));
// create a GraphMouse for the main view
//
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
vv1.setGraphMouse(graphMouse);
final ScalingControl scaler = new CrossoverScalingControl();
JButton plus = new JButton("+");
plus.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scaler.scale(vv1, 1.1f, vv1.getCenter());
}
});
JButton minus = new JButton("-");
minus.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
scaler.scale(vv1, 1/1.1f, vv1.getCenter());
}
});
JComboBox modeBox = graphMouse.getModeComboBox();
modeBox.addItemListener(((DefaultModalGraphMouse)vv2.getGraphMouse()).getModeListener());