FileDocCategorySizeDatePackage
MacOSAppAdapter.javaAPI DocExample3232Wed Jun 16 14:50:24 BST 2004com.darwinsys.macosui

MacOSAppAdapter

public class MacOSAppAdapter extends com.apple.eawt.Application
The only os-dependant part of com.darwinsys, this is the adapter class to handle MacOS's "different" way of doing About Box, Quit item in App menu, Preferences, and so on.

Fields Summary
com.apple.eawt.ApplicationListener
appListener
JFrame
parent
AboutBoxHandler
abouter
PrefsHandler
prefser
PrintHandler
printer
ShutdownHandler
shutter
Constructors Summary
public MacOSAppAdapter(JFrame theParent, AboutBoxHandler about, PrefsHandler prefs, PrintHandler print, ShutdownHandler shut)
Construct a MacOSAppAdapter.

param
theParent A JFrame, usually the main application window.
param
about A handler for the About box.
param
prefs A Preferences handler.
param
print A Print handler (bug: does not get invoked now).
param
shut A shutdown handler

		appListener = new MyAppEventHandler();
		parent = theParent;

		if (about != null) {
			abouter = about;
			setEnabledAboutMenu(true);
			addAboutMenuItem();
		}

		if (prefs != null) {
			prefser = prefs;
			setEnabledPreferencesMenu(true);
			addPreferencesMenuItem();
		}
		
		printer = print;

		shutter = shut;
	
Methods Summary
public voidregister()
Method to register this handler with Apple's event manager, calling addApplicationListener in parent class.

		addApplicationListener(appListener);