Back to index

wims  3.65+svn20090927
Help.java
Go to the documentation of this file.
00001 package rene.zirkel.help;
00002 
00003 import java.awt.*;
00004 import java.awt.event.*;
00005 import java.io.*;
00006 
00007 import rene.gui.*;
00008 import rene.viewer.*;
00009 import rene.zirkel.Zirkel;
00010 
00011 public class Help extends CloseFrame implements ActionListener
00012 {      Viewer V;
00013        Button Close;
00014        static public String CodePage="";
00015        // display the help from subject.txt
00016        public Help (String subject)
00017        {      super(Zirkel.name("help.title","Help"));
00018               V=new Viewer();
00019               if (Global.Background!=null) V.setBackground(Global.Background);
00020               V.setFont(Global.FixedFont);
00021               V.setTabWidth(4);
00022               String lang=Global.name("language","");
00023               while (true)
00024               {      try
00025                      {      BufferedReader in;
00026                             try
00027                             {      if (CodePage.equals(""))
00028                                           in=new BufferedReader(new InputStreamReader(
00029                                           getClass().getResourceAsStream("/rene/zirkel/docs/"+lang+subject),CodePage));
00030                                    else 
00031                                           in=new BufferedReader(new InputStreamReader(
00032                                           getClass().getResourceAsStream("/rene/zirkel/docs/"+lang+subject),CodePage));
00033                             }
00034                             catch (Exception e)
00035                             {      in=new BufferedReader(new InputStreamReader(
00036                                           getClass().getResourceAsStream("/rene/zirkel/docs/"+lang+subject)));
00037                             }
00038                             while (true)
00039                             {      String s=in.readLine();
00040                                    if (s==null) break;
00041                                    V.appendLine(s);
00042                             }
00043                             in.close();
00044                      }
00045                      catch (Exception e)
00046                      {      if (!lang.equals(""))
00047                             {      lang=""; continue;
00048                             }
00049                             else
00050                             {      V.setText(
00051                                           Zirkel.name("help.error","Could not find the help file!"));
00052                             }
00053                      }
00054                      break;
00055               }
00056               V.doUpdate(false);
00057               
00058               setLayout(new BorderLayout());
00059               setSize(600,600);
00060               setLocation(120,70);
00061               add("Center",V);
00062               Panel p=new MyPanel();
00063               p.add(Close=new Button(Zirkel.name("close","Close")));
00064               Close.addActionListener(this);
00065               add("South",p);
00066               setPosition("help");
00067               seticon("rene/zirkel/icon.png");
00068               setVisible(true);
00069        }
00070        public void actionPerformed (ActionEvent e)
00071        {      if (e.getSource()==Close)
00072               {      notePosition("help");
00073                      setVisible(false); dispose();
00074               }
00075        }
00076 }