KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > apple > OSXAdapter


1 package apple;
2
3 import com.apple.eawt.*;
4
5 import rero.gui.*;
6
7 /** A class for handling some OS X specific stuff. This class is built separately of the jIRC source code.
8     This code is meant to hook jIRC into the "jIRC" menu in the Apple menubar at the top of the screen. */

9 public class OSXAdapter extends ApplicationAdapter
10 {
11     private static com.apple.eawt.Application theApplication;
12
13     public void handleAbout(ApplicationEvent ae)
14     {
15         ae.setHandled(true);
16         SessionManager.getGlobalCapabilities().showAboutDialog();
17     }
18     
19     public void handlePreferences(ApplicationEvent ae)
20     {
21     ae.setHandled(true);
22         SessionManager.getGlobalCapabilities().showOptionDialog("");
23     }
24     
25     public void handleQuit(ApplicationEvent ae)
26     {
27     ae.setHandled(false);
28         SessionManager.getGlobalCapabilities().QuitClient();
29     }
30     
31 /* public void handleOpenFile(ApplicationEvent ev)
32     {
33 // ev.setHandled(true);
34         System.out.println("OpenFile: Asked to open " + ev.getFilename() + ", " + ev);
35     }
36
37     public void handleOpenApplication(ApplicationEvent ev)
38     {
39 // ev.setHandled(true);
40         System.out.println("Open Application: Asked to open " + ev.getFilename() + ", " + ev);
41     }
42
43     public void handleReOpenApplication(ApplicationEvent ev)
44     {
45 // ev.setHandled(true);
46         System.out.println("ReOpen Application: Asked to open " + ev.getFilename() + ", " + ev);
47     } */

48   
49     public static void registerMacOSXApplication()
50     {
51     if (theApplication == null)
52         {
53         theApplication = new com.apple.eawt.Application();
54         theApplication.setEnabledPreferencesMenu(true);
55         }
56         
57         theApplication.addApplicationListener(new OSXAdapter());
58     }
59 }
60
Popular Tags