/*******************************************************************************
 * GenRGenS v.1.0, Generation of Random Genomic Sequences                      *
 * Copyright (C) 2001  Alain Denise/Yann Ponty                                 *
 *                                                                             *
 * 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. *
 *******************************************************************************/

package GenRGenS.IU;

/**
 * Title:        GenRGenS User Interface<p>
 * Description:  An UI for GenRGenS<p>
 * Copyright:    Copyright (c) 2001 <p>
 * Company:      U.P.S. L.R.I./I.G.M<p>
 * @author  Yann Ponty
 * @version 1.0
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import GenRGenS.*;

public class MainFrame_AboutBox extends JDialog implements ActionListener
{

  JPanel panel1 = new JPanel();
  JPanel panel2 = new JPanel();
  JPanel insetsPanel1 = new JPanel();
  JPanel insetsPanel2 = new JPanel();
  JPanel insetsPanel3 = new JPanel();
  JButton button1 = new JButton();
  JLabel imageControl1 = new JLabel();
  ImageIcon imageIcon;
  JLabel label1 = new JLabel();
  JLabel label2 = new JLabel();
  JLabel label3 = new JLabel();
  JLabel label4 = new JLabel();
  BorderLayout borderLayout1 = new BorderLayout();
  BorderLayout borderLayout2 = new BorderLayout();
  FlowLayout flowLayout1 = new FlowLayout();
  FlowLayout flowLayout2 = new FlowLayout();
  String product = "";
  String version = "1.0";
  String copyright = "Copyright (c) ";
  String comments = "";
  JPanel jPanel1 = new JPanel();
  GridLayout gridLayout2 = new GridLayout();
  BorderLayout borderLayout3 = new BorderLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  JLabel jLabel5 = new JLabel();
  public MainFrame_AboutBox(Frame parent)
  {
    super(parent);
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try
    {
      jbInit();
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    //imageControl1.setIcon(imageIcon);
    pack();
  }

  private void jbInit() throws Exception
  {
    imageIcon = new ImageIcon(getClass().getResource("bin/GenRGenS.gif"));
    this.setTitle("About");
    setResizable(false);
    panel1.setLayout(borderLayout1);
    panel2.setLayout(borderLayout2);
    insetsPanel1.setLayout(flowLayout1);
    insetsPanel2.setLayout(flowLayout1);
    insetsPanel2.setBackground(Color.white);
    insetsPanel2.setBorder(new EmptyBorder(10, 10, 10, 10));
    label1.setText("GenRGenS User Interface v 1.0");
    label2.setToolTipText("");
    label2.setText("by Yann Ponty");
    label3.setText("Copyright (c) 2001");
    label4.setText("( LRI / IGM )");
    insetsPanel3.setLayout(borderLayout3);
    insetsPanel3.setBorder(new EmptyBorder(10, 60, 10, 10));
    button1.setText("Ok");
    button1.addActionListener(this);
    imageControl1.setIcon(imageIcon);
    jPanel1.setLayout(gridLayout2);
    gridLayout2.setColumns(1);
    gridLayout2.setRows(0);
    jLabel1.setHorizontalAlignment(SwingConstants.LEFT);
    jLabel1.setText("---------------------------------------");
    jLabel2.setText("Coded by Yann Ponty/Frederic Sarron");
    jLabel3.setText("Directed by Alain Denise");
    jLabel4.setText("For LRI/IGM");
    jLabel5.setText("GenRGenS v."+GenRGenS.version);
    insetsPanel2.add(imageControl1, null);
    panel2.add(insetsPanel2, BorderLayout.WEST);
    this.getContentPane().add(panel1, null);
    jPanel1.add(jLabel3, null);
    jPanel1.add(jLabel2, null);
    jPanel1.add(jLabel4, null);
    jPanel1.add(jLabel1, null);
    jPanel1.add(label1, null);
    jPanel1.add(label2, null);
    jPanel1.add(label3, null);
    jPanel1.add(label4, null);
    insetsPanel3.add(jLabel5, BorderLayout.NORTH);
    panel2.add(insetsPanel3, BorderLayout.CENTER);
    insetsPanel3.add(jPanel1, BorderLayout.CENTER);
    insetsPanel1.add(button1, null);
    panel1.add(insetsPanel1, BorderLayout.SOUTH);
    panel1.add(panel2, BorderLayout.NORTH);
  }

  protected void processWindowEvent(WindowEvent e)
  {
    if (e.getID() == WindowEvent.WINDOW_CLOSING)
    {
      cancel();
    }
    super.processWindowEvent(e);
  }

  void cancel()
  {
    dispose();
  }

  public void actionPerformed(ActionEvent e)
  {
    if (e.getSource() == button1)
    {
      cancel();
    }
  }
}
