001    /*
002     * VersionDialog.java
003     *
004     *
005     *  The Salamander Project - 2D and 3D graphics libraries in Java
006     *  Copyright (C) 2004 Mark McKay
007     *
008     *  This library is free software; you can redistribute it and/or
009     *  modify it under the terms of the GNU Lesser General Public
010     *  License as published by the Free Software Foundation; either
011     *  version 2.1 of the License, or (at your option) any later version.
012     *
013     *  This library is distributed in the hope that it will be useful,
014     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016     *  Lesser General Public License for more details.
017     *
018     *  You should have received a copy of the GNU Lesser General Public
019     *  License along with this library; if not, write to the Free Software
020     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021     *
022     *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
023     *  projects can be found at http://www.kitfox.com
024     *
025     * Created on January 13, 2005, 7:23 AM
026     */
027    
028    package com.kitfox.svg.app;
029    
030    import java.net.*;
031    import java.io.*;
032    import java.util.*;
033    import javax.swing.event.*;
034    import javax.swing.*;
035    import javax.swing.text.html.*;
036    
037    
038    /**
039     *
040     * @author  kitfox
041     */
042    public class VersionDialog extends javax.swing.JDialog
043    {
044        public static final long serialVersionUID = 1;
045        
046        final boolean verbose;
047        
048        /** Creates new form VersionDialog */
049        public VersionDialog(java.awt.Frame parent, boolean modal, boolean verbose)
050        {
051            super(parent, modal);
052            initComponents();
053            
054            this.verbose = verbose;
055            
056            textpane_text.setContentType("text/html");
057            
058            StringBuffer sb = new StringBuffer();
059            try
060            {
061                URL url = getClass().getResource("/res/help/about/about.html");
062                if (verbose)
063                {
064                    System.err.println("" + getClass() + " trying to load about html " + url);
065                }
066                
067                BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
068                while (true)
069                {
070                    String line = reader.readLine();
071                    if (line == null) break;
072                    sb.append(line);
073                }
074                
075                textpane_text.setText(sb.toString());
076            }
077            catch (Exception e)
078            {
079                e.printStackTrace();
080            }
081            
082        }
083        
084        /** This method is called from within the constructor to
085         * initialize the form.
086         * WARNING: Do NOT modify this code. The content of this method is
087         * always regenerated by the Form Editor.
088         */
089        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
090        private void initComponents()
091        {
092            jPanel1 = new javax.swing.JPanel();
093            textpane_text = new javax.swing.JTextPane();
094            jPanel2 = new javax.swing.JPanel();
095            bn_close = new javax.swing.JButton();
096    
097            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
098            setTitle("About SVG Salamander");
099            jPanel1.setLayout(new java.awt.BorderLayout());
100    
101            textpane_text.setEditable(false);
102            textpane_text.setPreferredSize(new java.awt.Dimension(400, 300));
103            jPanel1.add(textpane_text, java.awt.BorderLayout.CENTER);
104    
105            getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
106    
107            bn_close.setText("Close");
108            bn_close.addActionListener(new java.awt.event.ActionListener()
109            {
110                public void actionPerformed(java.awt.event.ActionEvent evt)
111                {
112                    bn_closeActionPerformed(evt);
113                }
114            });
115    
116            jPanel2.add(bn_close);
117    
118            getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
119    
120            pack();
121        }
122        // </editor-fold>//GEN-END:initComponents
123    
124        private void bn_closeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bn_closeActionPerformed
125        {//GEN-HEADEREND:event_bn_closeActionPerformed
126            setVisible(false);
127            dispose();
128        }//GEN-LAST:event_bn_closeActionPerformed
129        
130        /**
131         * @param args the command line arguments
132         */
133        public static void main(String args[])
134        {
135            java.awt.EventQueue.invokeLater(new Runnable()
136            {
137                public void run()
138                {
139                    new VersionDialog(new javax.swing.JFrame(), true, true).setVisible(true);
140                }
141            });
142        }
143        
144        // Variables declaration - do not modify//GEN-BEGIN:variables
145        private javax.swing.JButton bn_close;
146        private javax.swing.JPanel jPanel1;
147        private javax.swing.JPanel jPanel2;
148        private javax.swing.JTextPane textpane_text;
149        // End of variables declaration//GEN-END:variables
150        
151    }