/***************************************************
*
* cismet GmbH, Saarbruecken, Germany
*
* ... and it just works.
*
****************************************************/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* AboutDialog.java
*
* Created on 13.05.2009, 16:45:02
*/
package de.cismet.cismap.commons.gui.about;
/**
* DOCUMENT ME!
*
* @author thorsten
* @version $Revision$, $Date$
*/
public class AboutDialog extends javax.swing.JDialog {
//~ Static fields/initializers ---------------------------------------------
/** A return status code - returned if Cancel button has been pressed. */
public static final int RET_CANCEL = 0;
/** A return status code - returned if OK button has been pressed. */
public static final int RET_OK = 1;
//~ Instance fields --------------------------------------------------------
private int returnStatus = RET_CANCEL;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JButton okButton;
// End of variables declaration//GEN-END:variables
//~ Constructors -----------------------------------------------------------
/**
* Creates new form AboutDialog.
*
* @param parent DOCUMENT ME!
* @param modal DOCUMENT ME!
*/
public AboutDialog(final java.awt.Frame parent, final boolean modal) {
super(parent, modal);
initComponents();
}
//~ Methods ----------------------------------------------------------------
/**
* DOCUMENT ME!
*
* @return the return status of this dialog - one of RET_OK or RET_CANCEL
*/
public int getReturnStatus() {
return returnStatus;
}
/**
* 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() {
okButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(final java.awt.event.WindowEvent evt) {
closeDialog(evt);
}
});
okButton.setText(org.openide.util.NbBundle.getMessage(AboutDialog.class, "AboutDialog.okButton.text")); // NOI18N
okButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
jLabel1.setIcon(new javax.swing.ImageIcon(
getClass().getResource("/de/cismet/cismap/commons/gui/about/about_cismap.png"))); // NOI18N
final javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
layout.createSequentialGroup().addContainerGap().addGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
jLabel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).addComponent(
okButton,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE,
67,
javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup().addContainerGap().addComponent(
jLabel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
okButton).addContainerGap()));
pack();
} // </editor-fold>//GEN-END:initComponents
/**
* DOCUMENT ME!
*
* @param evt DOCUMENT ME!
*/
private void okButtonActionPerformed(final java.awt.event.ActionEvent evt) { //GEN-FIRST:event_okButtonActionPerformed
doClose(RET_OK);
} //GEN-LAST:event_okButtonActionPerformed
/**
* Closes the dialog.
*
* @param evt DOCUMENT ME!
*/
private void closeDialog(final java.awt.event.WindowEvent evt) { //GEN-FIRST:event_closeDialog
doClose(RET_CANCEL);
} //GEN-LAST:event_closeDialog
/**
* DOCUMENT ME!
*
* @param retStatus DOCUMENT ME!
*/
private void doClose(final int retStatus) {
returnStatus = retStatus;
setVisible(false);
dispose();
}
/**
* DOCUMENT ME!
*
* @param args the command line arguments
*/
public static void main(final String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
final AboutDialog dialog = new AboutDialog(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(final java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
}