/* * Copyright (c) 2004-2006 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the license. * * $Id: AboutWindow.java,v 1.7 2006/12/14 00:19:50 sshirasu Exp $ */ package edu.indiana.extreme.xbaya.gui; import java.awt.event.ActionEvent; import java.net.URL; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkEvent.EventType; import xsul5.MLogger; import xsul5.XmlConstants; import edu.indiana.extreme.xbaya.XBayaConstants; import edu.indiana.extreme.xbaya.XBayaEngine; import edu.indiana.extreme.xbaya.XBayaException; import edu.indiana.extreme.xbaya.XBayaVersion; import edu.indiana.extreme.xbaya.util.BrowserLauncher; /** * @author Satoshi Shirasuna */ public class AboutWindow { private static final MLogger logger = MLogger.getLogger(); private XBayaEngine engine; private XBayaDialog dialog; /** * Creates the AboutWindow. * * @param engine */ public AboutWindow(XBayaEngine engine) { this.engine = engine; init(); } /** * Shows the dialog. */ public void show() { this.dialog.show(); } private void hide() { this.dialog.hide(); } private void init() { JPanel buttonPanel = new JPanel(); JButton okButton = new JButton("OK"); okButton.setDefaultCapable(true); okButton.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { hide(); } }); buttonPanel.add(okButton); String message = "" + "

" + XBayaConstants.APPLICATION_NAME + "

" + "Version: " + XBayaVersion.VERSION + "
" + "" + XBayaConstants.WEB_URL.toString() + "" + ""; JEditorPane editorPane = new JEditorPane( XmlConstants.CONTENT_TYPE_HTML, message); editorPane.setEditable(false); editorPane.setBackground(buttonPanel.getBackground()); editorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { logger.entering(new Object[] { event }); if (event.getEventType() == EventType.ACTIVATED) { URL url = event.getURL(); try { BrowserLauncher.openURL(url.toString()); } catch (XBayaException e) { AboutWindow.this.engine.getErrorWindow().error( AboutWindow.this.dialog.getDialog(), e.getMessage(), e); } } } }); this.dialog = new XBayaDialog(this.engine, XBayaConstants.APPLICATION_NAME, editorPane, buttonPanel); this.dialog.setDefaultButton(okButton); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (c) 2004-2006 The Trustees of Indiana University. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1) All redistributions of source code must retain the above copyright notice, * the list of authors in the original source code, this list of conditions and * the disclaimer listed in this license; * * 2) All redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the disclaimer listed in this license in * the documentation and/or other materials provided with the distribution; * * 3) Any documentation included with all redistributions must include the * following acknowledgement: * * "This product includes software developed by the Indiana University Extreme! * Lab. For further information please visit http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software itself, and * wherever such third-party acknowledgments normally appear. * * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall * not be used to endorse or promote products derived from this software without * prior written permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana University" name * nor may "Indiana University" appear in their name, without prior written * permission of the Indiana University. * * Indiana University provides no reassurances that the source code provided * does not infringe the patent or any other intellectual property rights of any * other entity. Indiana University disclaims any liability to any recipient for * claims brought by any other entity based on infringement of intellectual * property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS. * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS", * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE. * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION * GENERATED USING SOFTWARE. */