/* * cameracontrol * Copyright (C) 2010 Stefano Fornari * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by * the Free Software Foundation with the addition of the following permission * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED * WORK IN WHICH THE COPYRIGHT IS OWNED BY Stefano Fornari, Stefano Fornari * DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with this program; if not, see http://www.gnu.org/licenses or write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ package ste.cameracontrol.ui; import java.awt.Frame; import java.util.Properties; /** * * @author ste */ public class AboutDialog extends javax.swing.JDialog { /** Creates new form AboutDialog */ public AboutDialog(Frame parent, boolean modal) { super(parent, modal); initComponents(); setLocationRelativeTo(null); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { infoPanel = new javax.swing.JPanel(); pictureLabel = new javax.swing.JLabel(); titleLable = new javax.swing.JLabel(); versionLabel = new javax.swing.JLabel(); copyrightLabel = new javax.swing.JLabel(); separator = new javax.swing.JSeparator(); licenseButton = new javax.swing.JButton(); okButton = new javax.swing.JButton(); creditsButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle(" About cameracontrol"); setModal(true); setName("about-dialog"); // NOI18N setResizable(false); pictureLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/about.png"))); // NOI18N pictureLabel.setBorder(null); titleLable.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); titleLable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); titleLable.setText("cameracontrol"); titleLable.setPreferredSize(new java.awt.Dimension(300, 29)); versionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); versionLabel.setText(getVersion()); versionLabel.setPreferredSize(new java.awt.Dimension(300, 17)); copyrightLabel.setFont(new java.awt.Font("DejaVu Sans", 0, 10)); // NOI18N copyrightLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); copyrightLabel.setText("Copyright © 2010 Stefano Fornari"); copyrightLabel.setPreferredSize(new java.awt.Dimension(300, 17)); javax.swing.GroupLayout infoPanelLayout = new javax.swing.GroupLayout(infoPanel); infoPanel.setLayout(infoPanelLayout); infoPanelLayout.setHorizontalGroup( infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(infoPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pictureLabel) .addComponent(titleLable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(versionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(copyrightLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); infoPanelLayout.setVerticalGroup( infoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, infoPanelLayout.createSequentialGroup() .addComponent(pictureLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE) .addComponent(titleLable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(versionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26) .addComponent(copyrightLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); licenseButton.setText("License"); licenseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { licenseButtonActionPerformed(evt); } }); okButton.setText("Close"); okButton.setMaximumSize(new java.awt.Dimension(60, 29)); okButton.setMinimumSize(new java.awt.Dimension(60, 29)); okButton.setPreferredSize(new java.awt.Dimension(60, 29)); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); creditsButton.setText("Credits"); creditsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { creditsButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(infoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(separator, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(65, Short.MAX_VALUE) .addComponent(creditsButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(licenseButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(infoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(licenseButton) .addComponent(creditsButton) .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed dispose(); }//GEN-LAST:event_okButtonActionPerformed private void licenseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_licenseButtonActionPerformed TextViewerForm f = new TextViewerForm((Frame)this.getParent(), true); f.setTitle(("GNU AFFERO GENERAL PUBLIC LICENSE")); f.loadText("agpl.txt"); f.setVisible(true); }//GEN-LAST:event_licenseButtonActionPerformed private void creditsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_creditsButtonActionPerformed TextViewerForm f = new TextViewerForm((Frame)this.getParent(), true); f.setTitle(("Credits")); f.loadText("credits.txt"); f.setVisible(true); }//GEN-LAST:event_creditsButtonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { AboutDialog dialog = new AboutDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel copyrightLabel; private javax.swing.JButton creditsButton; private javax.swing.JPanel infoPanel; private javax.swing.JButton licenseButton; private javax.swing.JButton okButton; private javax.swing.JLabel pictureLabel; private javax.swing.JSeparator separator; private javax.swing.JLabel titleLable; private javax.swing.JLabel versionLabel; // End of variables declaration//GEN-END:variables // --------------------------------------------------------- Private methods private String getVersion() { Properties projectProperties = new Properties(); try { projectProperties.load(ClassLoader.getSystemResourceAsStream("META-INF/maven/cameracontrol/cameracontrol/pom.properties")); } catch (Exception e) { return e.getMessage(); } return projectProperties.getProperty("version"); } }