| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
package speechrecorder; |
|---|
| 15 |
|
|---|
| 16 |
import java.net.URL; |
|---|
| 17 |
import javax.swing.JApplet; |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
public class RecorderApplet extends JApplet { |
|---|
| 24 |
|
|---|
| 25 |
static RecorderApplet applet; |
|---|
| 26 |
private CapturePlayback theRecorder; |
|---|
| 27 |
|
|---|
| 28 |
String subject; |
|---|
| 29 |
String fileFieldName; |
|---|
| 30 |
URL endPageURL; |
|---|
| 31 |
URL helpPageURL; |
|---|
| 32 |
URL destinationURL; |
|---|
| 33 |
String language; |
|---|
| 34 |
String endpage; |
|---|
| 35 |
String helppage; |
|---|
| 36 |
String cookie; |
|---|
| 37 |
|
|---|
| 38 |
public void init() { |
|---|
| 39 |
applet = this; |
|---|
| 40 |
|
|---|
| 41 |
getParameters(); |
|---|
| 42 |
getContentPane().add("Center", |
|---|
| 43 |
theRecorder = new CapturePlayback( language, destinationURL, endPageURL, helpPageURL, cookie)); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
public void start() { |
|---|
| 47 |
theRecorder.open(); |
|---|
| 48 |
} |
|---|
| 49 |
|
|---|
| 50 |
public void stop() { |
|---|
| 51 |
theRecorder.close(); |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
private void getParameters(){ |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
try { |
|---|
| 59 |
subject = getParameter("subject"); |
|---|
| 60 |
} catch (NullPointerException nullLang){ |
|---|
| 61 |
|
|---|
| 62 |
subject = null; |
|---|
| 63 |
errorMessage(System.out,"subject is null"); |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
try { |
|---|
| 67 |
|
|---|
| 68 |
cookie = getParameter("cookie"); |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
} catch (NullPointerException nullLang){ |
|---|
| 72 |
errorMessage(System.out,"cookie is null"); |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
try { |
|---|
| 77 |
language = getParameter("language"); |
|---|
| 78 |
if (language == "" || language == null) |
|---|
| 79 |
language = "EN"; |
|---|
| 80 |
|
|---|
| 81 |
} catch (NullPointerException nullLang){ |
|---|
| 82 |
|
|---|
| 83 |
language = "EN"; |
|---|
| 84 |
errorMessage(System.out,"language is null"); |
|---|
| 85 |
} |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
try { |
|---|
| 89 |
|
|---|
| 90 |
destinationURL = new URL(getParameter("destination")); |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
} catch(java.net.MalformedURLException malurlex){ |
|---|
| 95 |
|
|---|
| 96 |
errorMessage(System.out, "Badly formed destination:###"+getParameter("destination")+"###"); |
|---|
| 97 |
|
|---|
| 98 |
} catch(java.lang.NullPointerException npe){ |
|---|
| 99 |
|
|---|
| 100 |
errorMessage(System.out,"destination is null"); |
|---|
| 101 |
|
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
try { |
|---|
| 106 |
endPageURL = new URL(getParameter("endpage")); |
|---|
| 107 |
} catch(java.net.MalformedURLException malurlex){ |
|---|
| 108 |
errorMessage(System.out, "endpage is badly formed:###"+getParameter("endpage")+"###"); |
|---|
| 109 |
} catch(java.lang.NullPointerException npe){ |
|---|
| 110 |
errorMessage(System.out, "endpage is null"); |
|---|
| 111 |
} |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
public void errorMessage(java.io.PrintStream out, String message){ |
|---|
| 115 |
out.println("***"+message+"***"); |
|---|
| 116 |
} |
|---|
| 117 |
|
|---|
| 118 |
} |
|---|