/*
* This file is part of the aidGer project.
*
* Copyright (C) 2010-2013 The aidGer Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.aidger.view;
import static de.aidger.utils.Translation._;
import java.awt.Frame;
import javax.swing.Action;
import javax.swing.JDialog;
import de.aidger.controller.ActionNotFoundException;
import de.aidger.controller.ActionRegistry;
import de.aidger.controller.actions.DialogAbortAction;
import de.aidger.controller.actions.HomepageAction;
import de.aidger.utils.Logger;
/**
* A dialog, which contains information about the program and the authors.
*
* @author aidGer Team
*/
public class AboutDialog extends JDialog {
private static final long serialVersionUID = 1L;
/**
* @param owner
*/
public AboutDialog(Frame owner) {
super(owner, true);
Logger.debug("Opening AboutDialog");
initComponents();
try {
jButton1.setAction(ActionRegistry.getInstance().get(
DialogAbortAction.class.getName()));
jButton1.setText(_("Close"));
} catch (ActionNotFoundException ex) {
UI.displayError(ex.getMessage());
}
String version = getClass().getPackage().getImplementationVersion();
if (version.endsWith("-"))
version.substring(0, version.length() - 2);
if (!getClass().getPackage().getSpecificationVersion().isEmpty())
version += " @ " + getClass().getPackage().getSpecificationVersion().substring(0, 7);
jLabel1.setText("aidGer " + version);
setLocationRelativeTo(null);
pack();
}
/**
* 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(_("About aidGer"));
getContentPane().setLayout(new java.awt.GridBagLayout());
jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("aidGer 0.1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
getContentPane().add(jLabel1, gridBagConstraints);
jLabel2.setText(_("Authors: Christian Buchgraber, Philipp Gildein, Philipp Pirrung"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
getContentPane().add(jLabel2, gridBagConstraints);
jButton1.setText("Close");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10);
getContentPane().add(jButton1, gridBagConstraints);
jLabel3.setForeground(new java.awt.Color(2, 111, 213));
jLabel3.setText(_("Homepage: http://www.aidger.de"));
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10);
getContentPane().add(jLabel3, gridBagConstraints);
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aidger/res/icons/aidger-icon.png"))); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10);
getContentPane().add(jLabel4, gridBagConstraints);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
Logger.debug(_("Opening browser to http://aidger.de"));
try {
Action act = ActionRegistry.getInstance().get(
HomepageAction.class.getName());
act.actionPerformed(new java.awt.event.ActionEvent(this, 0, null));
} catch (ActionNotFoundException ex) {
UI.displayError(ex.getMessage());
}
}//GEN-LAST:event_jLabel3MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration//GEN-END:variables
}