001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.plugins.main.core.actions;
005    
006    import graphlab.platform.core.BlackBoard;
007    import graphlab.ui.UIUtils;
008    
009    import javax.swing.*;
010    import java.io.File;
011    import java.io.IOException;
012    
013    
014    /**
015     * displays the about dialog of graphlab
016     *
017     * @author azin azadi
018     */
019    public class ShowAboutDialog extends graphlab.platform.core.AbstractAction {
020        /**
021         * constructor
022         *
023         * @param bb the blackboard of the action
024         */
025        public ShowAboutDialog(BlackBoard bb) {
026            super(bb);
027            listen4Event(UIUtils.getUIEventKey("show about"));
028        }
029    
030    
031        public void performAction(String eventName, Object value) {
032            new Thread() {
033                public void run() {
034                    showAbout();
035                }
036            }.start();
037        }
038    
039        public static void showAbout() {
040            JFrame f = new JFrame("GraphLab");
041            JEditorPane browserPane = new JEditorPane();
042            browserPane.setContentType("text/html");
043            browserPane.setEditable(false);
044            try {
045                browserPane.setPage(new File("doc/about.html").toURL());
046            } catch (IOException e) {
047                e.printStackTrace();
048            }
049            f.add(new JScrollPane(browserPane));
050            f.setVisible(true);
051            f.setSize(500, 500);
052            f.validate();
053            f.setResizable(false);
054    //        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
055        }
056    }