Here is full code for a "Hello Java" Macintosh Dashboard Widget:
The file Hello Java.sit contains the following:
The class file used is from the source code HelloJava.java, invoked on this page here:
import java.applet.*;
import java.awt.*;
public class HelloJava extends Applet {
public void init()
{
setBackground(new Color(225,225, 255));
add(new Label("Hello Java"));
}
} // END OF Class HelloJava
The HTML code HelloJava.html just invokes the applet:
<html><head></head>
<body>
<APPLET code="HelloJava" WIDTH=80 HEIGHT=50></APPLET>
</body></html>
The Info.plist file is similar to Apple's Hello world example except that the AllowJava key is added:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Hello Java</string>
<key>CFBundleIdentifier</key>
<string>org.segal.widget.hellojava</string>
<key>CFBundleName</key>
<string>Hello Java</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CloseBoxInsetX</key>
<integer>16</integer>
<key>CloseBoxInsetY</key>
<integer>14</integer>
<key>MainHTML</key>
<string>HelloJava.html</string>
<key>AllowJava</key>
<true/>
</dict>
</plist>
The version.plist file is identical to that in Apple's example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>21</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>ProjectName</key>
<string>DashboardSDK</string>
<key>SourceVersion</key>
<string>40000</string>
</dict>
</plist>