com.pixelmed.display

## Class ApplicationFrame

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - java.awt.Window
      - - java.awt.Frame
        - - javax.swing.JFrame
          - - com.pixelmed.display.ApplicationFrame

- All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
  Direct Known Subclasses:
    DicomBrowser, DicomCleaner, DicomImageViewer, DoseUtility, DownloadOrTransmit, ECGViewer

      public class ApplicationFrame
      extends javax.swing.JFrame

  This class provides the infrastructure for creating applications (which extend this class) and provides them with utilities for creating a main window with a title and default close and dispose behavior, as well as access to properties, and a window snapshot function.

  See Also:
    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, java.awt.Window.Type`

    - ### 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`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.pixelmed.display.StatusBarManager` | `statusBarManager`

    - ### 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 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

    Constructors
    Constructor and Description
    `ApplicationFrame()` Construct a window with the default size and title and no property source.
    `ApplicationFrame(int closeOperation)` Construct a window with the default size and title and no property source.
    `ApplicationFrame(java.lang.String title)` Construct a window with the default size, specified title and no property source.
    `ApplicationFrame(java.lang.String title, int closeOperation)` Construct a window with the default size, specified title and no property source.
    `ApplicationFrame(java.lang.String title, java.lang.String applicationPropertyFileName)` Construct a window with the default size, and specified title and property sources.
    `ApplicationFrame(java.lang.String title, java.lang.String applicationPropertyFileName, int closeOperation)` Construct a window with the default size, and specified title and property sources.
    `ApplicationFrame(java.lang.String title, java.lang.String applicationPropertyFileName, int w, int h)` Construct a window with the specified size, title and property sources.
    `ApplicationFrame(java.lang.String title, java.lang.String applicationPropertyFileName, int w, int h, int closeOperation)` Construct a window with the specified size, title and property sources.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `createGUI()` Do what is necessary to build an application window.
    `protected java.lang.String` | `getApplicationPropertyFileName()` Get the name of the property file set for the application.
    `protected static java.lang.String` | `getBuildDate()` Get the date the package was built.
    `protected java.util.Properties` | `getProperties()` Get the properties for the application that have already been loaded (see `loadProperties()`).
    `static java.lang.String` | `getPropertyInsistently(java.util.Properties properties, java.lang.String key)` Searches for the property with the specified key in the specified property list, insisting on a value.
    `java.lang.String` | `getPropertyInsistently(java.lang.String key)` Searches for the property with the specified key in this application's property list, insisting on a value.
    `protected static java.lang.String` | `getReleaseString()` Get the release string for this application.
    `protected javax.swing.JLabel` | `getStatusBar()` Setup a StatusBarManager and return its StatusBar.
    `protected void` | `loadProperties()` Store the properties from the current properties file.
    `static void` | `main(java.lang.String[] arg)` For testing.
    `protected static java.lang.String` | `makePathToFileInUsersHomeDirectory(java.lang.String fileName)` Given a file name, such as the properties file name, make a path to it in the user's home directory.
    `protected void` | `setApplicationPropertyFileName(java.lang.String applicationPropertyFileName)` Set the name of the property file set for the application.
    `static void` | `setBackgroundForGUI()` Setup background for UI.
    `static void` | `setInternationalizedFontsForGUI()` Setup internationalized fonts if possible.
    `static void` | `setPreferredLookAndFeelForPlatform()` Setup preferred Look and Feel.
    `protected void` | `storeProperties(java.lang.String comment)` Store the current properties in the current properties file.
    `protected java.io.File` | `takeSnapShot(java.awt.Rectangle extent)` Store a JPEG snapshot of the specified window in the user's home directory.

    - ### Methods inherited from class javax.swing.JFrame

      `addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, 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, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated`

    - ### Methods inherited from class java.awt.Window

      `addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, 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, 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, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.awt.MenuContainer

      `getFont, postEvent`

- - ### Field Detail

    - #### statusBarManager

          protected com.pixelmed.display.StatusBarManager statusBarManager

  - ### Constructor Detail

    - #### ApplicationFrame

          public ApplicationFrame()

      Construct a window with the default size and title and no property source.

      Does not show the window.

      Will exit the application when the window closes.

    - #### ApplicationFrame

          public ApplicationFrame(int closeOperation)

      Construct a window with the default size and title and no property source.

      Does not show the window.

      Parameters:
        `closeOperation` - argument to `setDefaultCloseOperation()`

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title)

      Construct a window with the default size, specified title and no property source.

      Does not show the window.

      Will exit the application when the window closes.

      Parameters:
        `title` - the title for the top bar decoration

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title,
                                  int closeOperation)

      Construct a window with the default size, specified title and no property source.

      Does not show the window.

      Parameters:
        `title` - the title for the top bar decoration
        `closeOperation` - argument to `setDefaultCloseOperation()`

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title,
                                  java.lang.String applicationPropertyFileName)

      Construct a window with the default size, and specified title and property sources.

      Does not show the window.

      Will exit the application when the window closes.

      Parameters:
        `title` - the title for the top bar decoration
        `applicationPropertyFileName` - the name of the properties file

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title,
                                  java.lang.String applicationPropertyFileName,
                                  int closeOperation)

      Construct a window with the default size, and specified title and property sources.

      Does not show the window.

      Parameters:
        `title` - the title for the top bar decoration
        `applicationPropertyFileName` - the name of the properties file
        `closeOperation` - argument to `setDefaultCloseOperation()`

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title,
                                  java.lang.String applicationPropertyFileName,
                                  int w,
                                  int h)

      Construct a window with the specified size, title and property sources.

      Does not show the window.

      Will exit the application when the window closes.

      Parameters:
        `title` - the title for the top bar decoration
        `applicationPropertyFileName` - the name of the properties file
        `w` - width
        `h` - height

    - #### ApplicationFrame

          public ApplicationFrame(java.lang.String title,
                                  java.lang.String applicationPropertyFileName,
                                  int w,
                                  int h,
                                  int closeOperation)

      Construct a window with the specified size, title and property sources.

      Does not show the window.

      Parameters:
        `title` - the title for the top bar decoration
        `applicationPropertyFileName` - the name of the properties file
        `w` - width
        `h` - height
        `closeOperation` - argument to `setDefaultCloseOperation()`

  - ### Method Detail

    - #### getReleaseString

          protected static java.lang.String getReleaseString()

      Get the release string for this application.

      Returns:
        the release string

    - #### getBuildDate

          protected static java.lang.String getBuildDate()

      Get the date the package was built.

      Returns:
        the build date

    - #### getStatusBar

          protected javax.swing.JLabel getStatusBar()

      Setup a StatusBarManager and return its StatusBar.

      The initial string in the StatusBar is composed of the build date and release string.

      Returns:
        the StatusBar

    - #### makePathToFileInUsersHomeDirectory

          protected static java.lang.String makePathToFileInUsersHomeDirectory(java.lang.String fileName)

      Given a file name, such as the properties file name, make a path to it in the user's home directory.

      Parameters:
        `fileName` - the file name to make a path to

    - #### loadProperties

          protected void loadProperties()

      Store the properties from the current properties file.

    - #### storeProperties

          protected void storeProperties(java.lang.String comment)
                                  throws java.io.IOException

      Store the current properties in the current properties file.

      Parameters:
        `comment` - the description to store as the header of the properties file
      Throws:
        `java.io.IOException`

    - #### getProperties

          protected java.util.Properties getProperties()

      Get the properties for the application that have already been loaded (see `loadProperties()`).

      Returns:
        the properties

    - #### getApplicationPropertyFileName

          protected java.lang.String getApplicationPropertyFileName()

      Get the name of the property file set for the application.

      Returns:
        the property file name

    - #### setApplicationPropertyFileName

          protected void setApplicationPropertyFileName(java.lang.String applicationPropertyFileName)

      Set the name of the property file set for the application.

      Parameters:
        `applicationPropertyFileName` - the property file name

    - #### getPropertyInsistently

          public static java.lang.String getPropertyInsistently(java.util.Properties properties,
                                                                java.lang.String key)
                                                         throws java.lang.Exception

      Searches for the property with the specified key in the specified property list, insisting on a value.

      Parameters:
        `properties` - the property list to search
        `key` - the property name
      Throws:
        `java.lang.Exception` - if there is no such property or it has no value

    - #### getPropertyInsistently

          public java.lang.String getPropertyInsistently(java.lang.String key)
                                                  throws java.lang.Exception

      Searches for the property with the specified key in this application's property list, insisting on a value.

      Parameters:
        `key` - the property name
      Throws:
        `java.lang.Exception` - if there is no such property or it has no value

    - #### takeSnapShot

          protected java.io.File takeSnapShot(java.awt.Rectangle extent)

      Store a JPEG snapshot of the specified window in the user's home directory.

      Parameters:
        `extent` - the rectangle to take a snapshot of (typically `this.getBounds()` for whole application)

    - #### setInternationalizedFontsForGUI

          public static void setInternationalizedFontsForGUI()

      Setup internationalized fonts if possible.

      Invoked by `createGUI()`.

    - #### setBackgroundForGUI

          public static void setBackgroundForGUI()

      Setup background for UI.

      Invoked by `createGUI()`.

    - #### setPreferredLookAndFeelForPlatform

          public static void setPreferredLookAndFeelForPlatform()

      Setup preferred Look and Feel.

      Invoked by `createGUI()`.

    - #### createGUI

          protected void createGUI()

      Do what is necessary to build an application window.

      Invoked by constructors.

      Sub-classes should call this if they do not use the super() constructors, but should NOT usually need to override it, but rather should override the methods that it calls.

    - #### main

          public static void main(java.lang.String[] arg)

      For testing.

      Shows an empty default sized window.

      Parameters:
        `arg` - ignored