00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
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 }