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.*; 043import java.util.logging.Level; 044import java.util.logging.Logger; 045import javax.swing.event.*; 046import javax.swing.*; 047import javax.swing.text.html.*; 048 049 050/** 051 * 052 * @author kitfox 053 */ 054public class VersionDialog extends javax.swing.JDialog 055{ 056 public static final long serialVersionUID = 1; 057 058 final boolean verbose; 059 060 /** Creates new form VersionDialog */ 061 public VersionDialog(java.awt.Frame parent, boolean modal, boolean verbose) 062 { 063 super(parent, modal); 064 initComponents(); 065 066 this.verbose = verbose; 067 068 textpane_text.setContentType("text/html"); 069 070 StringBuffer sb = new StringBuffer(); 071 try 072 { 073 URL url = getClass().getResource("/res/help/about/about.html"); 074 if (verbose) 075 { 076 System.err.println("" + getClass() + " trying to load about html " + url); 077 } 078 079 BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); 080 while (true) 081 { 082 String line = reader.readLine(); 083 if (line == null) break; 084 sb.append(line); 085 } 086 087 textpane_text.setText(sb.toString()); 088 } 089 catch (Exception e) 090 { 091 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e); 092 } 093 094 } 095 096 /** This method is called from within the constructor to 097 * initialize the form. 098 * WARNING: Do NOT modify this code. The content of this method is 099 * always regenerated by the Form Editor. 100 */ 101 // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents 102 private void initComponents() 103 { 104 jPanel1 = new javax.swing.JPanel(); 105 textpane_text = new javax.swing.JTextPane(); 106 jPanel2 = new javax.swing.JPanel(); 107 bn_close = new javax.swing.JButton(); 108 109 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 110 setTitle("About SVG Salamander"); 111 jPanel1.setLayout(new java.awt.BorderLayout()); 112 113 textpane_text.setEditable(false); 114 textpane_text.setPreferredSize(new java.awt.Dimension(400, 300)); 115 jPanel1.add(textpane_text, java.awt.BorderLayout.CENTER); 116 117 getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); 118 119 bn_close.setText("Close"); 120 bn_close.addActionListener(new java.awt.event.ActionListener() 121 { 122 public void actionPerformed(java.awt.event.ActionEvent evt) 123 { 124 bn_closeActionPerformed(evt); 125 } 126 }); 127 128 jPanel2.add(bn_close); 129 130 getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); 131 132 pack(); 133 } 134 // </editor-fold>//GEN-END:initComponents 135 136 private void bn_closeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bn_closeActionPerformed 137 {//GEN-HEADEREND:event_bn_closeActionPerformed 138 setVisible(false); 139 dispose(); 140 }//GEN-LAST:event_bn_closeActionPerformed 141 142 /** 143 * @param args the command line arguments 144 */ 145 public static void main(String args[]) 146 { 147 java.awt.EventQueue.invokeLater(new Runnable() 148 { 149 public void run() 150 { 151 new VersionDialog(new javax.swing.JFrame(), true, true).setVisible(true); 152 } 153 }); 154 } 155 156 // Variables declaration - do not modify//GEN-BEGIN:variables 157 private javax.swing.JButton bn_close; 158 private javax.swing.JPanel jPanel1; 159 private javax.swing.JPanel jPanel2; 160 private javax.swing.JTextPane textpane_text; 161 // End of variables declaration//GEN-END:variables 162 163}