00001 package gui.Widgets;
00002
00003 import java.awt.Dimension;
00004 import java.awt.Point;
00005 import java.awt.Rectangle;
00006 import java.io.File;
00007 import java.io.IOException;
00008
00009 import javax.swing.JEditorPane;
00010 import javax.swing.JFrame;
00011 import javax.swing.JScrollPane;
00012
00013 import commandline.debuggingCode.Debug;
00014
00015
00016 public class About extends JFrame{
00017
00018 public About(JFrame jframe) {
00019 Rectangle bounds=jframe.getBounds();
00020 Point location= new Point((int)bounds.getCenterX(),(int)bounds.getCenterY());
00021 Dimension d=new Dimension((int)bounds.getWidth()/3,(int)bounds.getHeight()/3);
00022 location.translate(-(int)d.getWidth()/2,-(int)d.getHeight()/2);
00023 Rectangle newbounds=new Rectangle(location,d);
00024
00025 JEditorPane editorPane = new JEditorPane();
00026 editorPane.setEditable(false);
00027
00028 try {
00029
00030 String path=new File("").getAbsolutePath();
00031 String aboutpath="file:///"+path+ File.separator+"about.html";
00032 Debug.print(aboutpath);
00033 editorPane.setPage(aboutpath);
00034 } catch (IOException e) {
00035 Debug.print("Attempted to read a bad URL");
00036 }
00037
00038
00039 JScrollPane editorScrollPane = new JScrollPane(editorPane);
00040 editorScrollPane.setVerticalScrollBarPolicy(
00041 JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
00042 editorScrollPane.setPreferredSize(d);
00043 editorScrollPane.setMinimumSize(new Dimension(10, 10));
00044 this.getContentPane().add(editorScrollPane);
00045 this.setBounds(newbounds);
00046
00047 }
00048
00049 }