Source Code For:
"Application Foundation Classes"
Volume: 2,  Issue: 7, p.14

Listing 1: How to create a shell AFC applet.

// Listing 1: A shell AFC applet. Use this as a template for building your own AFC applets.

import java.applet.*;
import java.awt.*;
import com.ms.ui.*;
import com.ms.fx.*;

public class AFCAppletShell extends UIApplet {
public init() {
setBackground(FXColor.gray);
// Add other user interface components here
}
}

Listing 2: HTML required to embed the AFC
Applet.

<HTML>
<TITLE>A Shell AFC Applet</TITLE>
<CENTER>An Example AFC Applet</CENTER>
<APPLET CODE=AFCAppletShell.class
ID=AFCAppletShell
WIDTH=200
HEIGHT=200>
</APPLET>
</HTML>

Listing 3: How to create a shell AFC applet.

// Listing 3: A shell AFC application. Use this as a template
// for building your own AFC applications.

import java.applet.*;
import java.awt.*;
import com.ms.ui.*;
import com.ms.fx.*;

public class AFCAppShell extends UIApplet
public static void main(String args[])
AFCShellFrame frame = new
new AFCShellFrame("AFC Application Shell");
frame.show();
frame.resize(200,200);

AFCAppShell applet = new AFCAppShell();

// Add the applet to the frame
frame.add(applet);

applet.init();
}

public init() {
setBackground(FXColor.gray);
// Add other user interface components here
}
}

class AFCShellFrame extends UIFrame {
// Frame constructor
public AFCShellFrame(String str)
super(str);
}

// Frame event handler
public boolean handleEvent(Event evnt){
switch(evnt.id) {
// Close the application
case Event.WINDOW_DESTROY:
System.exit(0);
return(true);
// Pass all
other events to the UIFrame
// event handler
default:
super.handleEvent(evnt);
}
}
}
 

}