Subversion Repositories wimsdev

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     WIMSchem Elements: Chemistry molecular diagram drawing tool.
  3.    
  4.     (c) 2005 Dr. Alex M. Clark
  5.    
  6.     Released as GNUware, under the Gnu Public License (GPL)
  7.    
  8.     See www.gnu.org for details.
  9. */
  10.  
  11. package WIMSchem;
  12.  
  13. import java.io.*;
  14. import java.awt.*;
  15. import java.awt.event.*;
  16. import java.util.*;
  17. import javax.swing.*;
  18. // This launches the application from the applet...
  19. // so the added code is no good at all.
  20. public class LaunchApplet extends JApplet implements ActionListener
  21. {
  22.     JButton openbutton;
  23.     public Properties translation;
  24.  
  25.     public void init()
  26.     {
  27.         System.getProperty("java.version");
  28.         String language = getParameter("language");
  29.         if(language != null){language=language.toLowerCase();}else{language="en";}
  30.         translation=loadProperties(language);
  31.         openbutton=new JButton(translation.getProperty("Open_WIMSchem"));
  32.         add(openbutton);
  33.         openbutton.addActionListener(this);
  34.     }
  35.    
  36.     public Properties loadProperties (String l){
  37.         Properties P=new Properties();
  38.         try{
  39.             InputStream in = getClass().getResourceAsStream("/lang/WIMSchemProperties_"+l+".properties");
  40.             P.load(in);in.close();
  41.             return P;
  42.         }
  43.         catch (Exception e){ System.out.println("error reading /lang/WIMSchemProperties_"+l+".properties\n"+e);}        
  44.         return null;                                                                                                              
  45.     }  
  46.  
  47.  
  48.     public void actionPerformed(ActionEvent e)
  49.     {
  50.         if (e.getSource()==openbutton)
  51.         {
  52.             MainWindow mw=new MainWindow(null,false,translation);
  53.             mw.setVisible(true);
  54.             System.out.println("foo");
  55.         }
  56.     }
  57.  
  58.     public String getAppletInfo()
  59.     {
  60.         return translation.getProperty("WIMSchem_Applet_Description");
  61.     }
  62. }
  63.  
  64.  
  65.  
  66.