package netmatch;

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

public class JAboutDialog extends JWindow implements MouseListener/*, HyperlinkListener*/ {
  JEditorPane text;
  public JAboutDialog(netMatchPanel f, ImageIcon icon) {
    //setTitle("NetMatch About");
    //setResizable(false);
    JAboutPanel about = new JAboutPanel(icon);
    about.setLayout(null);
    addMouseListener(this);
    getContentPane().add(about, BorderLayout.CENTER);
    /*String s = "<p><font size=\"3\" face=\"Verdana\"><b>AUTHORS:</b><br><br>"+
            "<b>Gary Bader</b><br>" +
            "Banting and Best Department of Medical Research & Department of Medical" +
            "Genetics and Microbiology, University of Toronto, 160 College St," +
            "Toronto, Ontario, Canada M5S 3E1" +
            "<a href=\"mailto:gary.bader@utoronto.ca\">gary.bader@utoronto.ca</a><br><br>" +
            "<b>Alfredo Ferro</b><br>" +
            "Dept. of Mathematics and Computer Science, University of Catania<br>" +
            "<a href=\"mailto:ferro@dmi.unict.it\">ferro@dmi.unict.it</a><br><br>" +
            "<b>Rosalba Giugno</b><br>Dept. of Mathematics and Computer Science, University of Catania<br>" +
            "<a href=\"mailto:giugno@dmi.unict.it\">giugno@dmi.unict.it</a><br><br><b>Giuseppe Pigola</b><br>" +
            "Dept. of Mathematics and Computer Science, University of Catania<br>&nbsp;&nbsp;" +
            "<a href=\"mailto:pigola@dmi.unict.it\">pigola@dmi.unict.it</a><br><br><b>Alfredo Pulvirenti</b><br>" +
            "Dept. of Mathematics and Computer Science, University of Catania<br>" +
            "<a href=\"mailto:apulvirenti@dmi.unict.it\">apulvirenti@dmi.unict.it</a><br><br>"+
            "<b>Dennin Shasha</b><br>" +
            "Courant institute of Mathematical Science, New York University<br>" +
            "<a href=\"mailto:shasha@cs.nyu.edu\">shasha@cs.nyu.edu</a><br><br>" +
            "<b>Dimitry Skripin</b><br>" +
            "Dept. of Mathematics and Computer Science, University of Catania<br>" +
            "<a href=\"mailto:skripin@dmi.unict.it\">skripin@dmi.unict.it</a><br><br>"+
            "</font><font size=\"2\"></font>";

    HTMLEditorKit htmlKit = new HTMLEditorKit();
    HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
    try {
      htmlDoc.insertString(0,s,null);
    }
    catch(BadLocationException e) {
     //
    }
    text = new JEditorPane("text/html",s);
    text.setEditable(false);
    text.setBorder(new EtchedBorder());
    JScrollPane p = new JScrollPane();
    p.getViewport().add(text);
    p.setBounds(112,185,436,100);
    p.getVerticalScrollBar().setValue(p.getVerticalScrollBar().getMaximum());
    about.add(p);*/
    //p.getVerticalScrollBar().setValue(p.getVerticalScrollBar().getMaximum());
    pack();
    Rectangle r = f.getGraphicsConfiguration().getBounds();
    setLocation(r.x + r.width / 2 - getSize().width / 2, r.y + r.height / 2 - getSize().height / 2);
  }

  public void mouseClicked(MouseEvent e) {

  }

  public void mouseEntered(MouseEvent e) {

  }

  public void mouseExited(MouseEvent e) {

  }

  public void mousePressed(MouseEvent e) {
    setVisible(false);
    dispose();
  }

  public void mouseReleased(MouseEvent e) {

  }

  /*public void hyperlinkUpdate(HyperlinkEvent e) {
    if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      if(e instanceof HTMLFrameHyperlinkEvent) {
        ((HTMLDocument)text.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e);
      }
      else {
        try {
          //text.setPage(e.getURL());

        }
        catch (IOException ioe) {
           System.out.println("IOE: " + ioe);
        }
      }
    }
  }*/
}
