// Medusa is a graph viewer which allows interactive editing of networks
// (edges and nodes) and also connects to databases.
//
// Copyright (C) 2006 Sean Hooper
//
// 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 medusa;
import javax.swing.JDialog;
import java.awt.event.ActionListener;
import java.awt.Component;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import java.awt.Frame;
import java.awt.Container;
/**
* Show credits and adress to documentation
*/
public class AboutDialog extends JDialog implements ActionListener{
private static AboutDialog aboutFrame;
private AboutDialog(java.awt.Frame frame, java.awt.Component locationComp){
super(frame, "",true);
setDefaultLookAndFeelDecorated(true);
//ss.report();
init();
setLocationRelativeTo(locationComp);
}
JPanel aboutPanel;
JLabel aboutLabel;
JLabel titleLabel;
JPanel southPanel;
private String version=null;
JLabel westLabel;
JLabel versionLabel;
private void init(){
aboutPanel=new JPanel();
southPanel=new JPanel();
aboutLabel=new JLabel(aboutText);
versionLabel=new JLabel();
aboutLabel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
titleLabel=new JLabel(titleText);
//westLabel=new JLabel(" ");
//westLabel.setBackground(MedusaSimplerFrame.STRINGCOLOR);
// westLabel.setOpaque(true);
titleLabel.setBackground(MedusaSimplerFrame.STRINGCOLOR);
java.net.URL imageURL =
this.getClass().getResource("/medusa/images/medusa_logo_small.png");
titleLabel.setIcon(new javax.swing.ImageIcon(imageURL));
//aboutLabel.setVerticalAlignment(javax.swing.SwingConstants.LEFT);
titleLabel.setOpaque(true);
Container content = getContentPane();
aboutPanel.setLayout(new BorderLayout());
if (version!=null){
southPanel.add(versionLabel);
}
southPanel.add(submitButton);
content.add(aboutPanel);
aboutPanel.add("North",titleLabel);
aboutPanel.add("Center",aboutLabel);
submitButton.addActionListener(this);
aboutPanel.add("South",southPanel);
//aboutPanel.add("West",westLabel);
}
/**
* Actions when pressing buttons in dialog
* @param ae
*/
public void actionPerformed(ActionEvent ae) {
Object obj = ae.getSource();
//submit/done button action
if(obj.equals(submitButton)) {
submitButtonActionPerformed();
}
}
// handle events here
private void submitButtonActionPerformed() {
// TODO add your handling code here:
//System.out.println(e.report());
setVisible(false);
}
String titleText="Medusa
";
String aboutText="Authors:
Sean Hooper
Georgios Pavlopoulos"+
"EMBL Heidelberg 2008
"+
"hooper@embl.de
pavlopou@embl.de
"
+"
Full documentation atwww.bork.embl.de/medusa
";
private JButton submitButton = new JButton("OK");
/**
* Show the dialog
* @param frameComp Parent frame
* @param locationComp Location
*/
public static void showDialog(java.awt.Component frameComp,
java.awt.Component locationComp){
java.awt.Frame frame = javax.swing.JOptionPane.getFrameForComponent(frameComp);
aboutFrame=new AboutDialog(frame, locationComp);
aboutFrame.pack();
aboutFrame.setVisible(true);
}
public static void showDialog(java.awt.Component frameComp,
java.awt.Component locationComp,
String version){
java.awt.Frame frame = javax.swing.JOptionPane.getFrameForComponent(frameComp);
aboutFrame=new AboutDialog(frame, locationComp);
aboutFrame.setVersion(version);
aboutFrame.pack();
aboutFrame.setVisible(true);
}
public void setVersion(String version){
this.version=version;
}
}
Ads help maintain this website.