JButton forceDirectedLayout = new JButton("Auto Force Layout");
forceDirectedLayout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
fd = new ForceDirectedLayout(gp);
gp.getNanoGraph().setLayout(fd);
}
});
topPanel.add(forceDirectedLayout, FlowLayout.LEFT);