org.fife.ui.app
Class AbstractGUIApplication

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.fife.ui.app.AbstractGUIApplication
All Implemented Interfaces:
com.apple.osxadapter.NativeMacApp, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, GUIApplication, GUIApplicationConstants, DockableWindowConstants
Direct Known Subclasses:
AbstractPluggableGUIApplication

public abstract class AbstractGUIApplication
extends javax.swing.JFrame
implements GUIApplication, com.apple.osxadapter.NativeMacApp

A basic, generic GUI application. Your Swing application can override this class to have some of its basic code already implemented.

This class currently helps you implement:

Version:
0.6
Author:
Robert Futrell
See Also:
AbstractPluggableGUIApplication, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface org.fife.ui.app.GUIApplication
GUIApplication.AboutAction, GUIApplication.ExitAction, GUIApplication.HelpAction, GUIApplication.ToggleStatusBarAction, GUIApplication.ToggleToolBarAction
 
Field Summary
static java.lang.String ABOUT_ACTION_KEY
          The key for getting the About action from getAction.
protected  java.awt.Container actualContentPane
          This panel contains the actual content of the application (i.e., when the use calls getContentPane to add stuff, this is the panel they get).
static java.lang.String EXIT_ACTION_KEY
          The key for getting the Exit action from getAction.
static java.lang.String HELP_ACTION_KEY
          The key for getting the Help action from getAction.
protected  javax.swing.JPanel mainContentPanel
          This panel contains actualContentPane.
static java.lang.String STATUS_BAR_PROPERTY
          This property is fired whenever the status bar changes.
static java.lang.String STATUS_BAR_VISIBLE_PROPERTY
          This property is fired whenever the status bar is made visible or invisible.
static java.lang.String TOOL_BAR_PROPERTY
          This property is fired whenever the toolbar changes.
static java.lang.String TOOL_BAR_VISIBLE_PROPERTY
          This property is fired whenever the toolbar is made visible or invisible.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.fife.ui.app.GUIApplicationConstants
OS_LINUX, OS_MAC_OSX, OS_OTHER, OS_WINDOWS
 
Fields inherited from interface org.fife.ui.dockablewindows.DockableWindowConstants
BOTTOM, FLOATING, LEFT, RIGHT, TOP
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractGUIApplication(java.lang.String jarFile)
          Constructor.
AbstractGUIApplication(java.lang.String title, java.lang.String jarFile)
          Constructor.
AbstractGUIApplication(java.lang.String title, java.lang.String jarFile, GUIApplicationPreferences prefs)
          Constructor.
 
Method Summary
 void about()
          Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM.
 void addAction(java.lang.String key, javax.swing.Action action)
          Adds an action to this application's action map.
 void addToolBar(javax.swing.JToolBar toolBar, java.lang.String pos)
          Adds a toolbar to this GUI application.
protected  javax.swing.JDialog createAboutDialog()
          Creates the About dialog this application uses.
protected  void createActions(GUIApplicationPreferences prefs)
          Creates the actions used by this application.
protected abstract  javax.swing.JMenuBar createMenuBar(GUIApplicationPreferences prefs)
          Creates and returns the menu bar used in this application.
protected abstract  SplashScreen createSplashScreen()
          Creates and returns the splash screen to display while this GUI application is loading.
protected abstract  StatusBar createStatusBar(GUIApplicationPreferences prefs)
          Creates and returns the status bar to be used by this application.
protected abstract  CustomizableToolBar createToolBar(GUIApplicationPreferences prefs)
          Creates and returns the toolbar to be used by this application.
 void displayException(java.awt.Dialog owner, java.lang.Throwable t)
          Displays a dialog box telling the user that an Exception was thrown.
 void displayException(java.awt.Dialog owner, java.lang.Throwable t, java.lang.String desc)
          Displays a dialog box telling the user that an Exception was thrown.
 void displayException(java.awt.Frame owner, java.lang.Throwable t)
          Displays a dialog box telling the user that an Exception was thrown.
 void displayException(java.awt.Frame owner, java.lang.Throwable t, java.lang.String desc)
          Displays a dialog box telling the user that an Exception was thrown.
 void displayException(java.lang.Throwable t)
          Displays a dialog box telling the user that an Exception was thrown.
 void displayException(java.lang.Throwable t, java.lang.String desc)
          Displays a dialog box telling the user that an Exception was thrown.
 void doExit()
          Called when the user attempts to close the application, whether from an "Exit" menu item, closing the main application window, or any other means.
 ExtendedLookAndFeelInfo[] get3rdPartyLookAndFeelInfo()
          Returns an array of info. for JAR files containing 3rd party Look and Feels.
 javax.swing.JDialog getAboutDialog()
          Returns the About dialog for this application.
 javax.swing.Action getAction(java.lang.String key)
          Returns one of this application's actions.
 java.util.SortedSet<java.lang.String> getActionKeys()
          Returns the keys of all actions known to this application.
 javax.swing.Action[] getActions()
          Returns the actions of this GUI application as an array.
 java.awt.Container getContentPane()
          Returns the main content pane of the application.
abstract  HelpDialog getHelpDialog()
          Returns the Help dialog for this application, or null if this application does not have a Help dialog.
 java.lang.String getInstallLocation()
          Returns the directory in which this GUI application is installed (i.e., the location if the JAR file containing the main method).
 java.lang.String getLanguage()
          Returns the language used by this GUI application, in a Locale-friendly language string; e.g., en or es.
static java.lang.String getLocationOfJar(java.lang.String jarFileName)
          Returns the location of the specified jar file in the currently-running application's classpath.
 ThirdPartyLookAndFeelManager getLookAndFeelManager()
          Returns the manager in charge of any 3rd-party LookAndFeels this application is aware of.
 OptionsDialog getOptionsDialog()
          Returns this application's Options dialog.
 int getOS()
          Returns an integer constant representing the OS.
protected abstract  java.lang.String getPreferencesClassName()
          Returns the name of the preferences class for this application.
 java.util.ResourceBundle getResourceBundle()
          Returns the resource bundle associated with this application.
abstract  java.lang.String getResourceBundleClassName()
          Returns the fully-qualified class name of the resource bundle for this application.
 StatusBar getStatusBar()
          Returns the status bar this application is using.
 boolean getStatusBarVisible()
          Returns whether the status bar is visible.
 java.lang.String getString(java.lang.String key)
          Returns the localized text for the given key.
 java.lang.String getString(java.lang.String key, java.lang.Object param)
          Returns the localized text for the given key.
 java.lang.String getString(java.lang.String key, java.lang.Object[] params)
          Returns localized text for the given key.
 java.lang.String getString(java.lang.String key, java.lang.Object param1, java.lang.Object param2)
          Returns the localized text for the given key.
 java.lang.String getString(java.lang.String key, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Returns the localized text for the given key.
 CustomizableToolBar getToolBar()
          Returns the toolbar this application is using.
 boolean getToolBarVisible()
          Returns whether the toolbar is visible in this application.
abstract  java.lang.String getVersionString()
          Returns the version string for this application.
 boolean isMaximized()
          Returns true if this application's main window is maximized.
protected  void loadActionShortcuts(java.io.File file)
          Loads saved (customized) shortcuts for this application's actions from a file.
 GUIApplicationPreferences loadPreferences()
          Loads the preferences for this GUI application.
abstract  void openFile(java.lang.String fileName)
          Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM.
protected abstract  void preDisplayInit(GUIApplicationPreferences prefs, SplashScreen splashScreen)
          This is called in the GUI application's constructor.
abstract  void preferences()
          Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM.
protected abstract  void preMenuBarInit(GUIApplicationPreferences prefs, SplashScreen splashScreen)
          This is called in the GUI application's constructor.
protected abstract  void preStatusBarInit(GUIApplicationPreferences prefs, SplashScreen splashScreen)
          This is called in the GUI application's constructor.
protected abstract  void preToolBarInit(GUIApplicationPreferences prefs, SplashScreen splashScreen)
          This is called in the GUI application's constructor.
protected  void processWindowEvent(java.awt.event.WindowEvent e)
          Called when a window event occurs for this application.
 void quit()
          Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM.
protected  void saveActionShortcuts(java.io.File file)
          Saves the (customized) shortcuts for this application's actions from a file.
 void setContentPane(java.awt.Container contentPane)
          This method sets the content pane.
 void setLanguage(java.lang.String language)
          Sets the language for this GUI application and all of its dialogs, UI widgets, etc.
 void setLookAndFeelManager(ThirdPartyLookAndFeelManager manager)
          Sets the utility used to dynamically load 3rd-party LookAndFeels.
 void setStatusBar(StatusBar statusBar)
          Sets the status bar to use in this application.
 void setStatusBarVisible(boolean visible)
          Sets whether the status bar is visible.
 void setToolBar(CustomizableToolBar toolBar)
          Sets the toolbar used by this GUI application.
 void setToolBarVisible(boolean visible)
          Sets whether the toolbar used by this GUI application is visible.
 void updateLookAndFeel(javax.swing.LookAndFeel lnf)
          Updates the look and feel for all components and windows in this RText instance.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, repaint, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.fife.ui.app.GUIApplication
getIconImage, getJMenuBar, pack, setJMenuBar
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

STATUS_BAR_PROPERTY

public static final java.lang.String STATUS_BAR_PROPERTY
This property is fired whenever the status bar changes.

See Also:
Constant Field Values

STATUS_BAR_VISIBLE_PROPERTY

public static final java.lang.String STATUS_BAR_VISIBLE_PROPERTY
This property is fired whenever the status bar is made visible or invisible.

See Also:
Constant Field Values

TOOL_BAR_PROPERTY

public static final java.lang.String TOOL_BAR_PROPERTY
This property is fired whenever the toolbar changes.

See Also:
Constant Field Values

TOOL_BAR_VISIBLE_PROPERTY

public static final java.lang.String TOOL_BAR_VISIBLE_PROPERTY
This property is fired whenever the toolbar is made visible or invisible.

See Also:
Constant Field Values

ABOUT_ACTION_KEY

public static final java.lang.String ABOUT_ACTION_KEY
The key for getting the About action from getAction.

See Also:
Constant Field Values

EXIT_ACTION_KEY

public static final java.lang.String EXIT_ACTION_KEY
The key for getting the Exit action from getAction.

See Also:
Constant Field Values

HELP_ACTION_KEY

public static final java.lang.String HELP_ACTION_KEY
The key for getting the Help action from getAction.

See Also:
Constant Field Values

mainContentPanel

protected javax.swing.JPanel mainContentPanel
This panel contains actualContentPane. This panel is here so that the subclass AbstractPluggableGUIApplication can also place GUI plugins inside of it.


actualContentPane

protected java.awt.Container actualContentPane
This panel contains the actual content of the application (i.e., when the use calls getContentPane to add stuff, this is the panel they get).

Constructor Detail

AbstractGUIApplication

public AbstractGUIApplication(java.lang.String jarFile)
Constructor.

Parameters:
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").

AbstractGUIApplication

public AbstractGUIApplication(java.lang.String title,
                              java.lang.String jarFile)
Constructor.

Parameters:
title - The title for this frame.
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").

AbstractGUIApplication

public AbstractGUIApplication(java.lang.String title,
                              java.lang.String jarFile,
                              GUIApplicationPreferences prefs)
Constructor. This constructor is useful when you are making a clone of the current application (e.g., "Open in New Window...") and you want the two instances to have the same properties.

Parameters:
title - The title for this frame.
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").
prefs - The preferences with which to initialize this application.
Method Detail

about

public void about()
Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM. This is a hook for the standard Apple application menu. This method displays the application's About dialog.

Specified by:
about in interface com.apple.osxadapter.NativeMacApp
See Also:
getAboutDialog()

addAction

public void addAction(java.lang.String key,
                      javax.swing.Action action)
Adds an action to this application's action map.

Specified by:
addAction in interface GUIApplication
Parameters:
key - The key with which to fetch the action via getAction.
action - The action to add.
See Also:
createActions(GUIApplicationPreferences), getAction(String)

addToolBar

public void addToolBar(javax.swing.JToolBar toolBar,
                       java.lang.String pos)
Adds a toolbar to this GUI application. Note that this should only be used for toolbars other than the main toolbar.

Parameters:
toolBar - The toolbar to add.
pos - The position at which to add it (one of BorderLayout.NORTH, etc.).

createAboutDialog

protected javax.swing.JDialog createAboutDialog()
Creates the About dialog this application uses.

Returns:
The About dialog.
See Also:
getAboutDialog()

createActions

protected void createActions(GUIApplicationPreferences prefs)
Creates the actions used by this application. Implementations should override this method and add actions used by their application via addAction.

Parameters:
prefs - The preferences for this GUI application. This may contain information such as accelerators, etc.
See Also:
addAction(String, Action), getAction(String)

createMenuBar

protected abstract javax.swing.JMenuBar createMenuBar(GUIApplicationPreferences prefs)
Creates and returns the menu bar used in this application.

Parameters:
prefs - This GUI application's preferences.
Returns:
The menu bar.

createSplashScreen

protected abstract SplashScreen createSplashScreen()
Creates and returns the splash screen to display while this GUI application is loading.

Returns:
The splash screen. If null is returned, no splash screen is displayed.

createStatusBar

protected abstract StatusBar createStatusBar(GUIApplicationPreferences prefs)
Creates and returns the status bar to be used by this application. This method is called in this GUIApplication's constructor.

Parameters:
prefs - This GUI application's preferences.
Returns:
The status bar.

createToolBar

protected abstract CustomizableToolBar createToolBar(GUIApplicationPreferences prefs)
Creates and returns the toolbar to be used by this application. This method is called in this GUIApplication's constructor.

Parameters:
prefs - This GUI application's preferences.
Returns:
The toolbar.

displayException

public final void displayException(java.lang.Throwable t)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception.

Specified by:
displayException in interface GUIApplication
Parameters:
t - The exception/throwable that occurred.

displayException

public final void displayException(java.lang.Throwable t,
                                   java.lang.String desc)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception.

Parameters:
t - The exception/throwable that occurred.
desc - A short description of the error. This can be null.

displayException

public final void displayException(java.awt.Dialog owner,
                                   java.lang.Throwable t)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception. This version of the method allows a window spawned from the main GUI application window to be the owner of the displayed exception.

Specified by:
displayException in interface GUIApplication
Parameters:
owner - The dialog that threw the Exception.
t - The exception/throwable that occurred.

displayException

public void displayException(java.awt.Dialog owner,
                             java.lang.Throwable t,
                             java.lang.String desc)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception. This version of the method allows a window spawned from the main GUI application window to be the owner of the displayed exception.

Parameters:
owner - The dialog that threw the Exception.
t - The exception/throwable that occurred.
desc - A short description of the error. This can be null.

displayException

public final void displayException(java.awt.Frame owner,
                                   java.lang.Throwable t)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception. This version of the method allows a window spawned from the main GUI application window to be the owner of the displayed exception.

Specified by:
displayException in interface GUIApplication
Parameters:
owner - The child frame that threw the Exception.
t - The exception/throwable that occurred.

displayException

public void displayException(java.awt.Frame owner,
                             java.lang.Throwable t,
                             java.lang.String desc)
Displays a dialog box telling the user that an Exception was thrown. This method can be overridden to customize how the user is informed of an Exception. This version of the method allows a window spawned from the main GUI application window to be the owner of the displayed exception.

Parameters:
owner - The child frame that threw the Exception.
t - The exception/throwable that occurred.
desc - A short description of the error. This can be null.

doExit

public void doExit()
Called when the user attempts to close the application, whether from an "Exit" menu item, closing the main application window, or any other means. Applications should override this method to do any cleanup before the application exits. You can also prevent the application from closing based on the application's state in this method.

The default implementation simply calls System.exit(0).

Specified by:
doExit in interface GUIApplication

getAboutDialog

public javax.swing.JDialog getAboutDialog()
Returns the About dialog for this application.

Specified by:
getAboutDialog in interface GUIApplication
Returns:
The About dialog.
See Also:
AboutDialog, createAboutDialog()

getAction

public javax.swing.Action getAction(java.lang.String key)
Returns one of this application's actions.

Specified by:
getAction in interface GUIApplication
Returns:
The action, or null if no action exists for the specified key.
See Also:
addAction(String, Action), createActions(GUIApplicationPreferences)

getActionKeys

public java.util.SortedSet<java.lang.String> getActionKeys()
Returns the keys of all actions known to this application.

Specified by:
getActionKeys in interface GUIApplication
Returns:
The action keys.
See Also:
getAction(String)

getActions

public javax.swing.Action[] getActions()
Returns the actions of this GUI application as an array.

Specified by:
getActions in interface GUIApplication
Returns:
The actions.
See Also:
GUIApplication.getAction(String)

getContentPane

public java.awt.Container getContentPane()
Returns the main content pane of the application. Applications should add components to this panel.

Specified by:
getContentPane in interface javax.swing.RootPaneContainer
Overrides:
getContentPane in class javax.swing.JFrame
Returns:
The application's main content pane.
See Also:
setContentPane(Container)

getHelpDialog

public abstract HelpDialog getHelpDialog()
Returns the Help dialog for this application, or null if this application does not have a Help dialog.

Specified by:
getHelpDialog in interface GUIApplication
Returns:
The Help dialog.

getInstallLocation

public java.lang.String getInstallLocation()
Returns the directory in which this GUI application is installed (i.e., the location if the JAR file containing the main method).

Specified by:
getInstallLocation in interface GUIApplication
Returns:
The directory.

getLanguage

public java.lang.String getLanguage()
Returns the language used by this GUI application, in a Locale-friendly language string; e.g., en or es.

Specified by:
getLanguage in interface GUIApplication
Returns:
The language being used by this application.

getLookAndFeelManager

public ThirdPartyLookAndFeelManager getLookAndFeelManager()
Returns the manager in charge of any 3rd-party LookAndFeels this application is aware of.

Returns:
The manager, or null if there is none.
See Also:
setLookAndFeelManager(ThirdPartyLookAndFeelManager)

getLocationOfJar

public static java.lang.String getLocationOfJar(java.lang.String jarFileName)
Returns the location of the specified jar file in the currently-running application's classpath. This can be useful if you wish to know the location of the installation of the currently-running application.

For example, a Java program running from the executable jar Foo.jar can call this method with Foo.jar as the parameter, and the location of the jar file would be returned. With this knowledge, along with knowledge of the directory layout of the application, the programmer can access other files in the installation.

Parameters:
jarFileName - The name of the jar file for which to search.
Returns:
The directory in which the jar file resides.

get3rdPartyLookAndFeelInfo

public ExtendedLookAndFeelInfo[] get3rdPartyLookAndFeelInfo()
Returns an array of info. for JAR files containing 3rd party Look and Feels. These JAR files will be added to the UIManager's classpath so that these LnFs can be used in this GUI application.

For this method to return anything, you must install a ThirdPartyLookAndFeelManager.

Returns:
An array of information on JAR files containing Look and Feels.
See Also:
setLookAndFeelManager(ThirdPartyLookAndFeelManager)

getOptionsDialog

public OptionsDialog getOptionsDialog()
Returns this application's Options dialog.

Returns:
The options dialog, or null if this application doesn't have one. The default implementation returns null.

getOS

public int getOS()
Returns an integer constant representing the OS. This can be handy for special case situations such as Mac OS-X (special application registration) or Windows (allow mixed case, etc.).

Specified by:
getOS in interface GUIApplication
Returns:
An integer constant representing the OS.

getPreferencesClassName

protected abstract java.lang.String getPreferencesClassName()
Returns the name of the preferences class for this application. This class must be a subclass of GUIApplicationPreferences.

Returns:
The class name, or null if this GUI application does not save preferences.

getResourceBundle

public java.util.ResourceBundle getResourceBundle()
Returns the resource bundle associated with this application.

Specified by:
getResourceBundle in interface GUIApplication
Returns:
The resource bundle.
See Also:
getString(String), getString(String, Object), getString(String, Object[])

getResourceBundleClassName

public abstract java.lang.String getResourceBundleClassName()
Returns the fully-qualified class name of the resource bundle for this application. This is used by getResourceBundle to locate the class.

Returns:
The fully-qualified class name of the resource bundle.
See Also:
getResourceBundle()

getStatusBar

public StatusBar getStatusBar()
Returns the status bar this application is using.

Specified by:
getStatusBar in interface GUIApplication
Returns:
The status bar.
See Also:
setStatusBar(org.fife.ui.StatusBar)

getStatusBarVisible

public boolean getStatusBarVisible()
Returns whether the status bar is visible.

Specified by:
getStatusBarVisible in interface GUIApplication
Returns:
Whether the status bar is visible. If this application does not have a status bar, null is returned.
See Also:
setStatusBarVisible(boolean)

getString

public java.lang.String getString(java.lang.String key)
Returns the localized text for the given key. This method is equivalent to getResourceBundle().getString(key).

Parameters:
key - The key into the resource bundle.
Returns:
The localized text.
See Also:
getString(String, Object), getString(String, Object[]), getResourceBundle()

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object param)
Returns the localized text for the given key.

Parameters:
key - The key into the resource bundle.
param - A parameter in the localized text.
Returns:
The localized text.
See Also:
getString(String), getString(String, Object[]), getResourceBundle()

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object param1,
                                  java.lang.Object param2)
Returns the localized text for the given key.

Parameters:
key - The key into the resource bundle.
param1 - A parameter in the localized text.
param2 - Another parameter in the localized text.
Returns:
The localized text.
See Also:
getString(String), getString(String, Object), getString(String, Object[]), getResourceBundle()

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object param1,
                                  java.lang.Object param2,
                                  java.lang.Object param3)
Returns the localized text for the given key.

Parameters:
key - The key into the resource bundle.
param1 - A parameter in the localized text.
param2 - Another parameter in the localized text.
param3 - Another parameter in the localized text.
Returns:
The localized text.
See Also:
getString(String), getString(String, Object), getString(String, Object[]), getResourceBundle()

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object[] params)
Returns localized text for the given key.

Parameters:
key - The key into the resource bundle.
params - Parameters for the localized text.
Returns:
The localized text.
See Also:
getString(String), getString(String, Object), getResourceBundle()

getToolBar

public CustomizableToolBar getToolBar()
Returns the toolbar this application is using.

Specified by:
getToolBar in interface GUIApplication
Returns:
The toolbar.
See Also:
setToolBar(org.fife.ui.CustomizableToolBar)

getToolBarVisible

public boolean getToolBarVisible()
Returns whether the toolbar is visible in this application.

Specified by:
getToolBarVisible in interface GUIApplication
Returns:
Whether the toolbar is visible. If this application has no toolbar, false is returned.
See Also:
setToolBarVisible(boolean)

getVersionString

public abstract java.lang.String getVersionString()
Returns the version string for this application.

Specified by:
getVersionString in interface GUIApplication
Returns:
The version string.

isMaximized

public boolean isMaximized()
Returns true if this application's main window is maximized.

Specified by:
isMaximized in interface GUIApplication
Returns:
true if this applicaiton's window is maximized, or false if it isn't.

loadActionShortcuts

protected void loadActionShortcuts(java.io.File file)
Loads saved (customized) shortcuts for this application's actions from a file. Implementations are expected to call this method after creating their actions via createActions(GUIApplicationPreferences) to restore any user customizations to shortcuts (assuming the application allows them).

If an IO error occurs, an error is displayed to the user.

Parameters:
file - The file to load from.
See Also:
saveActionShortcuts(File)

loadPreferences

public GUIApplicationPreferences loadPreferences()
Loads the preferences for this GUI application. If this application does not use preferences or something, null is goes wrong, null is returned.

Specified by:
loadPreferences in interface GUIApplication
Returns:
This application's preferences.

openFile

public abstract void openFile(java.lang.String fileName)
Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM. This is a hook for the standard Apple application menu. This method gets called when we receive an open event from the finder on Mac OS X, and should be overridden to do whatever makes sense in your application to "open a file."

Specified by:
openFile in interface com.apple.osxadapter.NativeMacApp

preferences

public abstract void preferences()
Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM. This is a hook for the standard Apple application menu. This method should be overridden to show the Options dialog.

Specified by:
preferences in interface com.apple.osxadapter.NativeMacApp

preDisplayInit

protected abstract void preDisplayInit(GUIApplicationPreferences prefs,
                                       SplashScreen splashScreen)
This is called in the GUI application's constructor. It is a chance for subclasses to do initialization of stuff that will be needed by the class before the application is displayed on-screen.

Parameters:
prefs - The preferences of the application.
splashScreen - The "splash screen" for this application. This value may be null.

preMenuBarInit

protected abstract void preMenuBarInit(GUIApplicationPreferences prefs,
                                       SplashScreen splashScreen)
This is called in the GUI application's constructor. It is a chance for subclasses to do initialization of stuff that will be needed by their menu bar before it gets created.

Parameters:
prefs - The preferences of the application.
splashScreen - The "splash screen" for this application. This value may be null.

preStatusBarInit

protected abstract void preStatusBarInit(GUIApplicationPreferences prefs,
                                         SplashScreen splashScreen)
This is called in the GUI application's constructor. It is a chance for subclasses to do initialization of stuff that will be needed by their status bar before it gets created.

Parameters:
prefs - The preferences of the application.
splashScreen - The "splash screen" for this application. This value may be null.

preToolBarInit

protected abstract void preToolBarInit(GUIApplicationPreferences prefs,
                                       SplashScreen splashScreen)
This is called in the GUI application's constructor. It is a chance for subclasses to do initialization of stuff that will be needed by their toolbar before it gets created.

Parameters:
prefs - The preferences of the application.
splashScreen - The "splash screen" for this application. This value may be null.

processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent e)
Called when a window event occurs for this application.

Overrides:
processWindowEvent in class javax.swing.JFrame
Parameters:
e - The window event.

quit

public void quit()
Gets called from the OSXAdapter; this method is needed by the Mac OS X JVM. This is a hook for the standard Apple application menu. This method calls doExit.

Specified by:
quit in interface com.apple.osxadapter.NativeMacApp
See Also:
doExit()

saveActionShortcuts

protected void saveActionShortcuts(java.io.File file)
Saves the (customized) shortcuts for this application's actions from a file. Implementations are expected to call this method when shutting down, to save any user customizations to shortcuts (assuming the application allows them).

If an IO error occurs, an error is displayed to the user.

Parameters:
file - The file to save to.
See Also:
loadActionShortcuts(File)

setContentPane

public void setContentPane(java.awt.Container contentPane)
This method sets the content pane. It is overridden so it does not meddle with the status bar, toolbar, etc.

Specified by:
setContentPane in interface javax.swing.RootPaneContainer
Overrides:
setContentPane in class javax.swing.JFrame
Parameters:
contentPane - The new content pane.
See Also:
getContentPane()

setLanguage

public void setLanguage(java.lang.String language)
Sets the language for this GUI application and all of its dialogs, UI widgets, etc.

Specified by:
setLanguage in interface GUIApplication
Parameters:
language - The language to use. If null, English will be used.

setLookAndFeelManager

public void setLookAndFeelManager(ThirdPartyLookAndFeelManager manager)
Sets the utility used to dynamically load 3rd-party LookAndFeels.

Parameters:
manager - The utility, or null for none.
See Also:
getLookAndFeelManager()

setStatusBar

public void setStatusBar(StatusBar statusBar)
Sets the status bar to use in this application. This method fires a property change of type STATUS_BAR_PROPERTY.

Specified by:
setStatusBar in interface GUIApplication
Parameters:
statusBar - The status bar to use.
See Also:
getStatusBar()

setStatusBarVisible

public void setStatusBarVisible(boolean visible)
Sets whether the status bar is visible. This method fires a property change of type STATUS_BAR_VISIBLE_PROPERTY.

Specified by:
setStatusBarVisible in interface GUIApplication
Parameters:
visible - Whether the status bar is to be visible.
See Also:
getStatusBarVisible()

setToolBar

public void setToolBar(CustomizableToolBar toolBar)
Sets the toolbar used by this GUI application. This method fires a property change of type TOOL_BAR_PROPERTY.

Specified by:
setToolBar in interface GUIApplication
Parameters:
toolBar - The toolbar to use.
See Also:
getToolBar()

setToolBarVisible

public void setToolBarVisible(boolean visible)
Sets whether the toolbar used by this GUI application is visible. This method fires a property change of type TOOL_BAR_VISIBLE_PROPERTY.

Specified by:
setToolBarVisible in interface GUIApplication
Parameters:
visible - Whether the toolbar should be visible.
See Also:
getToolBarVisible()

updateLookAndFeel

public void updateLookAndFeel(javax.swing.LookAndFeel lnf)
Updates the look and feel for all components and windows in this RText instance. This method assumes that UIManager.setLookAndFeel(lnf) has already been called.

Subclasses should override this method to update any child dialogs or windows, and be sure to call the super implementation as well.

Parameters:
lnf - The new look and feel. You can usually ignore this parameter, as the LookAndFeel has already been installed.