001 ///////////////////////////////////////////////// 002 //This file is part of Sears project. 003 //Subtitle Editor And Re-Synch 004 //A tool to easily modify and resynch movies subtitles. 005 ///////////////////////////////////////////////// 006 //This program is free software; 007 //you can redistribute it and/or modify it under the terms 008 //of the GNU General Public License 009 //as published by the Free Software Foundation; 010 //either version 2 of the License, or (at your option) any later version. 011 ///////////////////////////////////////////////// 012 //Sears project is available under sourceforge 013 //at adress: http://sourceforge.net/projects/sears/ 014 //Copyright (C) 2005 Booba Skaya 015 //Mail: booba.skaya@gmail.com 016 ///////////////////////////////////////////////// 017 018 package sears.tools.eawt; 019 020 /** 021 * <tt>SearsApp</tt> allows Sears to have a good integration on Mac OS X, 022 * allows Sears to use java API delivery by Apple (especially classes in eawt package) 023 */ 024 public class SearsApp { 025 // the singleton instance of Application: 026 private static ApplicationWrapper searsApp; 027 028 /** 029 * Creates a new object 030 * @throws AppException if searsApp object could not be created 031 */ 032 public SearsApp() throws AppException { 033 if( searsApp == null ) { 034 searsApp = ApplicationWrapper.getApplication(); 035 } 036 037 // no needed at this time, see Main class: 038 setPreferences(); 039 searsApp.addPreferencesMenuItem(); 040 searsApp.setEnabledPreferencesMenu(true); 041 searsApp.addApplicationListener( 042 ApplicationListenerHandler.getWrappedApplicationListenerInstance( 043 new SearsApplicationListener())); 044 } 045 046 /** 047 * this method set preferences to Sears: 048 * <br> - apple.laf.useScreenMenuBar to true 049 * <br> - apple.awt.showGrowBox to true 050 */ 051 private static void setPreferences(){ 052 // set the menu bar on the top of the screen, 053 // if default style "apple.laf.AquaLookAndFeel" has changed by user, 054 // the menu bar returns on the top of the main JFrame. 055 System.setProperty( "apple.laf.useScreenMenuBar", "true" ); 056 // others properties: 057 System.setProperty( "apple.awt.showGrowBox", "true" ); 058 System.setProperty( "apple.awt.textantialiasing" , "true" ); 059 } 060 }