/*
  AboutDialog.java
 
  (P)2002 Dana Cristofor
*/

/*

GAClust - Clustering categorical databases using genetic algorithms
Copyright (C) 2002  Dana Cristofor


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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA

GAClust was written by Dana Cristofor (dana@cs.umb.edu).

*/

import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;

/**
 * The GAClust About dialog
 *
 * @version 	1.0
 * @author	Dana Cristofor
 */
public class AboutDialog extends CenteredJDialog 
  implements ActionListener
{
  // Variables declaration
  private JPanel CenterPanel;
  private JTextArea AboutTextArea;
  private JPanel SouthPanel;
  private JButton CloseButton;
  // End of variables declaration

  /** Creates new form AboutDialog */
  public AboutDialog(Frame parent, boolean modal) 
  {
    super(parent, modal);
    initComponents();
  }

  /** This method is called from within the constructor to
   * initialize the form.
   */
  private void initComponents() 
  {
    CenterPanel = new JPanel();
    AboutTextArea = new JTextArea();
    SouthPanel = new JPanel();
    CloseButton = new JButton();
        
    setTitle(Strings.ABOUT);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModal(true);
    setResizable(false);

    addWindowListener(new WindowAdapter() {
	public void windowClosing(WindowEvent evt) {
	  closeDialog();
	}
      });
        
    AboutTextArea.setLineWrap(true);
    AboutTextArea.setEditable(false);
    AboutTextArea.setText(Strings.ABOUT_TEXT);
    AboutTextArea.setBackground(Color.lightGray);
    AboutTextArea.setPreferredSize(new Dimension(380, 200));
        
    CenterPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
    CenterPanel.add(AboutTextArea);
        
    getContentPane().add(CenterPanel, BorderLayout.CENTER);
        
    CloseButton.setText(Strings.CLOSE);
    CloseButton.addActionListener(this);
    CloseButton.setMnemonic(KeyEvent.VK_C);
    CloseButton.setToolTipText(Strings.CLOSE_TIP);
    SouthPanel.add(CloseButton);
        
    getContentPane().add(SouthPanel, BorderLayout.SOUTH);

    pack();

    center();
  }

  public void actionPerformed(ActionEvent event)
  {
    if (event.getSource() == CloseButton) 
      closeDialog();
  }

  /** Closes the dialog */
  private void closeDialog() 
  {
    setVisible(false);
    dispose();
  }
}

