|
Java 6 SE Platform 6.0 Home |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.woven_media.colorsafe.Application
public abstract class Application
Base Application class for Swing apps. Application provides the following functionality:
Application provides a handful of methods that are invoked as part of starting the application. Subclasses need only override those they are interested in. The following outlines the order the methods are invoked in as well as what they are intended for. All methods are invoked on the event dispatching thread.
Constructor Summary | |
---|---|
Application()
Creates a new Application instance. |
Method Summary | |
---|---|
void |
addApplicationListener(ApplicationListener listener)
Adds a listener for application events. |
protected boolean |
canExit()
Returns whether the application should be allowed to exit. |
protected javax.swing.JDialog |
createBackgroundThreadDialog()
Returns the dialog to show when waiting for any background threads to exit. |
void |
exit()
Exits the application. |
protected void |
exiting()
Invoked as part of exiting the application. |
java.util.concurrent.ThreadFactory |
getBackgroundThreadFactory()
Returns a ThreadFactory suitable for threads used within Swing applications. |
java.lang.Object |
getData(java.lang.Object key)
Returns the value for the specified user key. |
static Application |
getInstance()
Returns the single Application instance. |
abstract java.lang.String |
getName()
Returns the name of the application. |
java.util.prefs.Preferences |
getPreferences()
Returns the Preferences object for the Application. |
protected java.lang.Class |
getPreferencesKey()
Returns the Class key used to fetch the Preferences object. |
static java.lang.String |
getResourceAsString(java.lang.String key)
Convenience method to return a resource from the Application as a String. |
java.util.ResourceBundle |
getResourceBundle()
Returns the ResourceBundle for the Application. |
protected java.lang.String |
getResourceBundleName()
Returns the key for loading the resources for the Application. |
protected javax.swing.JDialog |
getUncaughtExceptionDialog()
Returns the dialog that is shown when an uncaught exception is encountered. |
protected void |
init()
Invoked as part of starting the application. |
protected void |
installLookAndFeel()
Invoked from preInit to set the look and feel for the Application. |
static boolean |
isOSX()
Returns true if running on Apple's OS X. |
protected void |
postInit()
Invoked as part of starting the application. |
protected void |
postInitEventQueueEmpty()
Invoked as part of starting the application. |
protected void |
preInit()
Invoked as part of starting the application. |
void |
putData(java.lang.Object key,
java.lang.Object value)
Associated the specified value with the specified key. |
void |
registerThread(java.lang.Thread thread)
Registers a background thread with the Application. |
void |
removeApplicationListener(ApplicationListener listener)
Adds a listener for application events. |
void |
start()
Starts the Application. |
void |
uncaughtException(java.lang.Thread thread,
java.lang.Throwable throwable)
Invoked when an uncaught exception is encountered. |
void |
uncaughtException(java.lang.Throwable throwable)
Invoked when an uncaught exception is encountered. |
protected void |
waitForBackgroundThreadsToExit()
Blocks until all registered threads have completed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Application()
java.lang.IllegalStateException
- if an Application has already been createdMethod Detail |
---|
public static Application getInstance()
public static java.lang.String getResourceAsString(java.lang.String key)
key
- the key identifying the resource to obtain
public static boolean isOSX()
public void addApplicationListener(ApplicationListener listener)
listener
- the ApplicationListener to addpublic void removeApplicationListener(ApplicationListener listener)
listener
- the ApplicationListener to addpublic final void putData(java.lang.Object key, java.lang.Object value)
key
- the key to store the value invalue
- the value to associated with keypublic final java.lang.Object getData(java.lang.Object key)
key
- the key used to retrieve the specified value
public final java.util.prefs.Preferences getPreferences()
getPreferencesKey()
protected java.lang.Class getPreferencesKey()
getPreferences()
public final java.util.ResourceBundle getResourceBundle()
getResourceBundleName()
protected java.lang.String getResourceBundleName()
getClass().getName().resources.Resources
.
public java.util.concurrent.ThreadFactory getBackgroundThreadFactory()
When exit is invoked the Application will block until all background threads have exited.
registerThread(java.lang.Thread)
,
waitForBackgroundThreadsToExit()
public final void registerThread(java.lang.Thread thread)
This method is thread safe.
thread
- the Thread to wait for completion on
java.lang.IllegalArgumentException
- if thread is nullpublic abstract java.lang.String getName()
protected void installLookAndFeel()
protected void preInit()
installLookAndFeel()
protected void init()
protected void postInit()
protected void postInitEventQueueEmpty()
public final void start()
main
. Refer to
init sequence for details on which methods
this invokes.
java.lang.IllegalStateException
- if start has already been invokedprotected boolean canExit()
exit()
protected void exiting()
protected void waitForBackgroundThreadsToExit()
exit()
,
createBackgroundThreadDialog()
public final void exit()
canExit()
,
waitForBackgroundThreadsToExit()
public void uncaughtException(java.lang.Throwable throwable)
throwable
- the thrown exceptionpublic void uncaughtException(java.lang.Thread thread, java.lang.Throwable throwable)
exit
.
uncaughtException
in interface java.lang.Thread.UncaughtExceptionHandler
thread
- the thread the exception was thrown onthrowable
- the thrown exceptiongetUncaughtExceptionDialog()
protected javax.swing.JDialog getUncaughtExceptionDialog()
uncaughtException(java.lang.Throwable)
protected javax.swing.JDialog createBackgroundThreadDialog()
|
Java 6 SE Platform 6.0 Home |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |