public class MDIApplication extends Application
Modified by: Joseph A. Huwaldt
Constructor and Description |
---|
MDIApplication()
Constructor a new MDIApplication instance with no name.
|
MDIApplication(java.lang.String name)
Constructor a new MDIApplication instance that has the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
addQuitListener(QuitListener listener)
Register an object to receive notification that the application is going to quit
soon.
|
void |
addWindow(java.awt.Window window)
Register the supplied window with the list of windows managed by this
MDIApplication.
|
java.util.List<java.awt.Window> |
allOpenWindows()
Get an unmodifiable list of all the currently open windows in the application.
|
AboutJMenuItem |
createAboutMenuItem()
Method used to create an about menu item for use in this application.
|
java.io.FilenameFilter |
getFilenameFilter()
Return a reference to this application's default file name filter or null if a
filename filter has not been stored.
|
static MDIApplication |
getInstance()
Return the unique instance of this application.
|
Preferences |
getPreferences() |
boolean |
getQuitOnClose()
Returns a flag indicating if the application should quit when the last window is
closed (true) or stay open (false; allowing the user to select "New" from the file
menu for instance).
|
java.util.ResourceBundle |
getResourceBundle()
Returns the resource bundle stored with this application.
|
java.awt.Window |
getTopWindow()
Returns a reference to the top-most window in the list of all open windows
registered with this application.
|
void |
handleClose(java.awt.event.ActionEvent event)
Handle the user choosing "Close" from the File menu.
|
java.awt.Frame |
handleNew(java.awt.event.ActionEvent event)
Handle the user requesting a new document window.
|
void |
handleQuit(java.awt.event.ActionEvent event)
Handle the user choosing "Quit" from the File menu.
|
javax.swing.JMenu |
newWindowsMenu(java.lang.String title)
Get a new JMenu instance that can be used as a Windows menu using the specified
title (typically "Windows").
|
void |
removeQuitListener(QuitListener listener)
Method to remove a quit listener from the list of quit listeners for this
application.
|
void |
setFilenameFilter(java.io.FilenameFilter filter)
Used to set the filename filter for this application.
|
void |
setPreferences(Preferences prefs)
Used to set the user preferences for this application.
|
void |
setQuitOnClose(boolean flag)
Sets a flag indicating if the application should quit when the last window is
closed (true) or stay open (false; allowing the user to select "New" from the file
menu for instance).
|
void |
setResourceBundle(java.util.ResourceBundle bundle)
Used to set the resource bundle for this application.
|
void |
windowTitleChanged(java.awt.Window window)
Call this method when a window being shown in a Windows menu has changed it's
title.
|
public MDIApplication()
IllegalStateException
being thrown.public MDIApplication(java.lang.String name)
IllegalStateException
being thrown.name
- The name of the application.public static MDIApplication getInstance()
public void setResourceBundle(java.util.ResourceBundle bundle)
bundle
- The resource bundle to be stored with this application.public java.util.ResourceBundle getResourceBundle()
public void setPreferences(Preferences prefs)
prefs
- The user preferences for this application.public final Preferences getPreferences()
public void setFilenameFilter(java.io.FilenameFilter filter)
filter
- The filename filter to be stored with this application.public java.io.FilenameFilter getFilenameFilter()
public void setQuitOnClose(boolean flag)
flag
- Set to true to have the application automatically quit when all the
windows close.public boolean getQuitOnClose()
public void addWindow(java.awt.Window window)
window
- The window to be added to the list of open windows.public void addQuitListener(QuitListener listener)
listener
- The listener to register.public void removeQuitListener(QuitListener listener)
listener
- The listener to remove.public java.awt.Window getTopWindow()
public java.util.List<java.awt.Window> allOpenWindows()
public javax.swing.JMenu newWindowsMenu(java.lang.String title)
title
- The title for the Windows menu.public void windowTitleChanged(java.awt.Window window)
window
- The window that has changed titles.public AboutJMenuItem createAboutMenuItem()
public java.awt.Frame handleNew(java.awt.event.ActionEvent event)
event
- The event that caused this method to be called. May be "null" if this
method is called by MDIApplication or one of it's subclasses.public void handleClose(java.awt.event.ActionEvent event)
event
- The event that caused this method to be called.public void handleQuit(java.awt.event.ActionEvent event)
event
- The event that caused this method to be called.