001/*
002 * SVG Salamander
003 * Copyright (c) 2004, Mark McKay
004 * All rights reserved.
005 *
006 * Redistribution and use in source and binary forms, with or 
007 * without modification, are permitted provided that the following
008 * conditions are met:
009 *
010 *   - Redistributions of source code must retain the above 
011 *     copyright notice, this list of conditions and the following
012 *     disclaimer.
013 *   - Redistributions in binary form must reproduce the above
014 *     copyright notice, this list of conditions and the following
015 *     disclaimer in the documentation and/or other materials 
016 *     provided with the distribution.
017 *
018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
019 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
020 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
021 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
022 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
023 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
025 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
026 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
027 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
029 * OF THE POSSIBILITY OF SUCH DAMAGE. 
030 * 
031 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
032 * projects can be found at http://www.kitfox.com
033 *
034 * Created on January 13, 2005, 7:23 AM
035 */
036
037package com.kitfox.svg.app;
038
039import com.kitfox.svg.SVGConst;
040import java.net.*;
041import java.io.*;
042import java.util.logging.Level;
043import java.util.logging.Logger;
044
045/**
046 *
047 * @author  kitfox
048 */
049public class VersionDialog extends javax.swing.JDialog
050{
051    public static final long serialVersionUID = 1;
052    
053    final boolean verbose;
054    
055    /** Creates new form VersionDialog */
056    public VersionDialog(java.awt.Frame parent, boolean modal, boolean verbose)
057    {
058        super(parent, modal);
059        initComponents();
060        
061        this.verbose = verbose;
062        
063        textpane_text.setContentType("text/html");
064        
065        StringBuffer sb = new StringBuffer();
066        try
067        {
068            URL url = getClass().getResource("/res/help/about/about.html");
069            if (verbose)
070            {
071                System.err.println("" + getClass() + " trying to load about html " + url);
072            }
073            
074            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
075            while (true)
076            {
077                String line = reader.readLine();
078                if (line == null) break;
079                sb.append(line);
080            }
081            
082            textpane_text.setText(sb.toString());
083        }
084        catch (Exception e)
085        {
086            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
087        }
088        
089    }
090    
091    /** This method is called from within the constructor to
092     * initialize the form.
093     * WARNING: Do NOT modify this code. The content of this method is
094     * always regenerated by the Form Editor.
095     */
096    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
097    private void initComponents()
098    {
099        jPanel1 = new javax.swing.JPanel();
100        textpane_text = new javax.swing.JTextPane();
101        jPanel2 = new javax.swing.JPanel();
102        bn_close = new javax.swing.JButton();
103
104        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
105        setTitle("About SVG Salamander");
106        jPanel1.setLayout(new java.awt.BorderLayout());
107
108        textpane_text.setEditable(false);
109        textpane_text.setPreferredSize(new java.awt.Dimension(400, 300));
110        jPanel1.add(textpane_text, java.awt.BorderLayout.CENTER);
111
112        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
113
114        bn_close.setText("Close");
115        bn_close.addActionListener(new java.awt.event.ActionListener()
116        {
117            public void actionPerformed(java.awt.event.ActionEvent evt)
118            {
119                bn_closeActionPerformed(evt);
120            }
121        });
122
123        jPanel2.add(bn_close);
124
125        getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
126
127        pack();
128    }
129    // </editor-fold>//GEN-END:initComponents
130
131    private void bn_closeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bn_closeActionPerformed
132    {//GEN-HEADEREND:event_bn_closeActionPerformed
133        setVisible(false);
134        dispose();
135    }//GEN-LAST:event_bn_closeActionPerformed
136    
137    /**
138     * @param args the command line arguments
139     */
140    public static void main(String args[])
141    {
142        java.awt.EventQueue.invokeLater(new Runnable()
143        {
144            public void run()
145            {
146                new VersionDialog(new javax.swing.JFrame(), true, true).setVisible(true);
147            }
148        });
149    }
150    
151    // Variables declaration - do not modify//GEN-BEGIN:variables
152    private javax.swing.JButton bn_close;
153    private javax.swing.JPanel jPanel1;
154    private javax.swing.JPanel jPanel2;
155    private javax.swing.JTextPane textpane_text;
156    // End of variables declaration//GEN-END:variables
157    
158}