source: trunk/src/org/apollo/ApolloSystemApplet.java@ 1023

Last change on this file since 1023 was 489, checked in by davidb, 11 years ago

Changes made when making Apollo run as an applet

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