Package prefuse.util.force

Source Code of prefuse.util.force.ForceConfigAction

package prefuse.util.force;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;

import prefuse.util.ui.JForcePanel;

/**
* Swing Action components that brings up a dialog allowing users to configure
* a force simulation.
*
* @author <a href="http://jheer.org">jeffrey heer</a>
* @see prefuse.util.ui.JForcePanel
*/
public class ForceConfigAction extends AbstractAction {

    private JDialog dialog;
   
    /**
     * Create a new ForceConfigAction.
     * @param frame the parent frame for which to create the dialog
     * @param fsim the force simulator to configure
     */
    public ForceConfigAction(JFrame frame, ForceSimulator fsim) {
        dialog = new JDialog(frame, false);
        dialog.setTitle("Configure Force Simulator");
        JPanel forcePanel = new JForcePanel(fsim);
        dialog.getContentPane().add(forcePanel);
        dialog.pack();
    }
   
    /**
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    public void actionPerformed(ActionEvent e) {
        dialog.setVisible(true);
    }

} // end of class ForceConfigAction
TOP

Related Classes of prefuse.util.force.ForceConfigAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.