1 | package org.apollo;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 |
|
---|
5 | import java.awt.event.ActionEvent;
|
---|
6 | import java.awt.event.ActionListener;
|
---|
7 | import javax.swing.*;
|
---|
8 |
|
---|
9 | import org.expeditee.gui.Browser;
|
---|
10 |
|
---|
11 | public class ApolloSystemApplet extends JApplet implements ActionListener
|
---|
12 | {
|
---|
13 |
|
---|
14 | // point of entry for applet
|
---|
15 | public void init()
|
---|
16 | {
|
---|
17 |
|
---|
18 | // Check if the user has agreed to the requested security settings
|
---|
19 | try {
|
---|
20 | // Work-around to reduce number of
|
---|
21 | // 'Could not lock user prefs' error messages.
|
---|
22 | // Thanks to Walter Schatz from the java forums.
|
---|
23 | System.setProperty("java.util.prefs.syncInterval","2000000");
|
---|
24 | }
|
---|
25 | catch (Exception exception) {
|
---|
26 | getContentPane().add(new JLabel("Expeditee Applet deactivated", JLabel.CENTER));
|
---|
27 | return;
|
---|
28 | }
|
---|
29 |
|
---|
30 | // Ensure platform specific LAF
|
---|
31 | try {
|
---|
32 | UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
---|
33 | }
|
---|
34 | catch (Exception exception) {
|
---|
35 | exception.printStackTrace();
|
---|
36 | }
|
---|
37 |
|
---|
38 | // If there is username parameter passed in, use that
|
---|
39 |
|
---|
40 | String expeditee_home = this.getParameter("expeditee.home");
|
---|
41 |
|
---|
42 | if (expeditee_home == null) {
|
---|
43 | expeditee_home = System.getProperty("user.home") + File.separator + "expeditee";
|
---|
44 | }
|
---|
45 |
|
---|
46 | System.setProperty("expeditee.home",expeditee_home);
|
---|
47 |
|
---|
48 | // Create a button for the user to press to open the main Expeditee frame
|
---|
49 | JButton launch_button = new JButton("Launch Musical Expeditee ...");
|
---|
50 | launch_button.addActionListener(this);
|
---|
51 | getContentPane().add(launch_button);
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | public void start()
|
---|
56 | {
|
---|
57 | System.err.println("Applet start() called");
|
---|
58 | }
|
---|
59 |
|
---|
60 |
|
---|
61 | public void stop()
|
---|
62 | {
|
---|
63 | System.err.println("Applet stop() called");
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | public void destroy()
|
---|
68 | {
|
---|
69 | System.err.println("Applet destroy() called");
|
---|
70 |
|
---|
71 | ApolloSystem.shutdown();
|
---|
72 |
|
---|
73 | Browser._theBrowser.exit();
|
---|
74 | Browser._theBrowser = null;
|
---|
75 | System.err.println("Expeditee exited.");
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | public void actionPerformed(ActionEvent e)
|
---|
80 | {
|
---|
81 | if (Browser._theBrowser==null) {
|
---|
82 | ApolloSystem.main(null);
|
---|
83 | }
|
---|
84 | else {
|
---|
85 | // call set visible??
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | /*
|
---|
90 | public static void main(String[] args) {
|
---|
91 |
|
---|
92 | }
|
---|
93 | */
|
---|
94 |
|
---|
95 |
|
---|
96 | }
|
---|