Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

HelpWindow.java

00001 /*
00002  *  Copyright 2006-2007 Columbia University.
00003  *
00004  *  This file is part of MEAPsoft.
00005  *
00006  *  MEAPsoft is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License version 2 as
00008  *  published by the Free Software Foundation.
00009  *
00010  *  MEAPsoft is distributed in the hope that it will be useful, but
00011  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with MEAPsoft; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00018  *  02110-1301 USA
00019  *
00020  *  See the file "COPYING" for the text of the license.
00021  */
00022 
00023 /*
00024  * Created on Jul 14, 2006
00025  *
00026  * To change the template for this generated file go to
00027  * Window>Preferences>Java>Code Generation>Code and Comments
00028  */
00029 package com.meapsoft.gui;
00030 
00031 import java.awt.BorderLayout;
00032 import java.awt.Color;
00033 import java.awt.Dimension;
00034 import java.awt.event.ActionEvent;
00035 import java.awt.event.ActionListener;
00036 
00037 import java.io.IOException;
00038 
00039 import java.net.MalformedURLException;
00040 
00041 import javax.swing.BoxLayout;
00042 import javax.swing.JButton;
00043 import javax.swing.JEditorPane;
00044 import javax.swing.JFrame;
00045 import javax.swing.JPanel;
00046 import javax.swing.JScrollPane;
00047 import javax.swing.JTextArea;
00048 import javax.swing.text.JTextComponent;
00049 
00056 public class HelpWindow extends JFrame
00057 {
00058         JButton closeButton;
00059     JTextComponent textArea = null;
00060         
00061         public HelpWindow(String url, String title, Color c)
00062         {
00063         super(title);
00064 
00065                 JPanel panel = new JPanel(new BorderLayout());
00066         panel.setBackground(c);
00067                 
00068         try
00069         {
00070             textArea = new JEditorPane(url);
00071         }
00072         catch(MalformedURLException e)
00073         {
00074             textArea = new JTextArea(url);
00075         }
00076         catch(IOException e)
00077         {}
00078 
00079                 //textArea.setColumns(50);
00080                 textArea.setBackground(c);
00081                 textArea.setEditable(false);
00082         JScrollPane scrollPane = new JScrollPane(textArea);
00083                 panel.add(scrollPane, BorderLayout.CENTER);
00084 
00085         panel.setPreferredSize(new Dimension(600, 400));
00086 
00087                 JPanel cbPanel = new JPanel();
00088         cbPanel.setBackground(c);
00089                 closeButton = new JButton("close");
00090         closeButton.setBackground(c);
00091                 closeButton.addActionListener(
00092                         new ActionListener() {
00093                                 public void actionPerformed(ActionEvent e) {
00094                                         setVisible(false);
00095                                 }
00096                         }
00097                 );
00098         cbPanel.add(closeButton);
00099                 panel.add(cbPanel, BorderLayout.SOUTH);
00100 
00101         setContentPane(panel);
00102         pack();
00103                 setLocation(23, 23);
00104         setVisible(true);
00105         }
00106 }

Generated on Tue Feb 6 19:02:26 2007 for MEAPsoft by doxygen1.2.18