Subversion Repositories wimsdev

Rev

Rev 3662 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3662 Rev 7246
Line 1... Line 1...
1
/*
1
/*
2
    WIMSchem Elements: Chemistry molecular diagram drawing tool.
2
    Sketch Elements: Chemistry molecular diagram drawing tool.
3
   
3
   
4
    (c) 2005 Dr. Alex M. Clark
4
    (c) 2005 Dr. Alex M. Clark
5
   
5
   
6
    Released as GNUware, under the Gnu Public License (GPL)
6
    Released as GNUware, under the Gnu Public License (GPL)
7
   
7
   
Line 13... Line 13...
13
import java.io.*;
13
import java.io.*;
14
import java.awt.*;
14
import java.awt.*;
15
import java.awt.event.*;
15
import java.awt.event.*;
16
import java.util.*;
16
import java.util.*;
17
import javax.swing.*;
17
import javax.swing.*;
18
// This launches the application from the applet...
-
 
19
// so the added code is no good at all.
-
 
-
 
18
 
20
public class LaunchApplet extends JApplet implements ActionListener
19
public class LaunchApplet extends JApplet implements ActionListener
21
{
20
{
22
    JButton openbutton;
21
    JButton openbutton;
23
    public Properties translation;
-
 
24
 
22
 
25
    public void init()
23
    public void init()
26
    {
24
    {
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"));
25
        openbutton=new JButton("Open WIMSchem");
32
        add(openbutton);
26
        add(openbutton);
33
        openbutton.addActionListener(this);
27
        openbutton.addActionListener(this);
34
    }
28
    }
35
   
29
   
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)
30
    public void actionPerformed(ActionEvent e)
49
    {
31
    {
50
        if (e.getSource()==openbutton)
32
        if (e.getSource()==openbutton)
51
        {
33
        {
52
            MainWindow mw=new MainWindow(null,false,translation);
34
            MainWindow mw=new MainWindow(null,false);
53
            mw.setVisible(true);
35
            mw.setVisible(true);
54
            System.out.println("foo");
36
            System.out.println("foo");
55
        }
37
        }
56
    }
38
    }
57
 
39
 
58
    public String getAppletInfo()
40
    public String getAppletInfo()
59
    {
41
    {
60
        return translation.getProperty("WIMSchem_Applet_Description");
42
        return "WIMSchem: Applet version of chemistry\nmolecular diagram drawing tool.";
61
    }
43
    }
62
}
44
}
63
 
-
 
64
 
-
 
65
 
-