www.pudn.com > DomView.zip > HelpAboutDialog.java
/********************************************************************
Domview 1.0 displays contents of an XML DOM object
Copyright (C) 1999 The Bean Factory, LLC.
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.
Author: Sun Koh, The Bean Factory, LLC.
*******************************************************************/
import java.awt.*; //AWT classes
import java.awt.event.*; //AWT event classes
import java.util.*; //Vectors, etc
import java.io.*; //Serializable, etc
import java.net.*; //Network classes
import javax.swing.*; //Swing classes
import javax.swing.event.*; //Swing events
import javax.swing.table.*; //JTable models
import javax.swing.tree.*; //JTree models
import javax.swing.border.*; //JComponent Borders
/********************************************************************
HelpAboutDialog displays copyright information.
@version : 1.0
@author : Sun Koh
********************************************************************/
public class HelpAboutDialog
extends JDialog
implements java.io.Serializable {
//
// Data Members
//
protected static final String message = "DomView version 1.0,\nCopyright (C) 1999 The Bean Factory, LLC. \n\n DomView comes with ABSOLUTELY NO WARRANTY; for details go to Help->GPL. This is free software, and you are welcome to redistribute it under certain conditions; go to Help->GPL for details.";
//
// Methods
//
/**
Default Constructor
@param d DomView frame
*/
public HelpAboutDialog(DomView mainFrame){
this.setTitle("About");
this.setModal(true);
Container c = this.getContentPane();
JTextArea ta = new JTextArea();
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.setEditable(false);
ta.setText(message);
JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton btn = new JButton(" OK ");
btn.addActionListener(new OkAction(this));
p.add(btn);
c.setLayout(new BorderLayout());
c.add(p, BorderLayout.SOUTH);
c.add(new JScrollPane(ta), BorderLayout.CENTER);
pack();
setLocationRelativeTo(mainFrame);
show();
} //end method
/**
Return preferrred size of this panel
@return a dimension of the panel
*/
public Dimension getPreferredSize(){
return new Dimension(300, 250);
}
/**
Return minimun size of this panel
@return a dimension of the panel
*/
public Dimension getMinimunSize(){
return getPreferredSize();
}
/**
Cancel Action inner class
*/
protected class OkAction implements ActionListener {
HelpAboutDialog dialog;
public OkAction(HelpAboutDialog f){
dialog = f;
}
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
}
}//end of Dialog class