Class ApplicationFrame
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants
- Direct Known Subclasses:
DicomBrowser,DicomCleaner,DicomImageViewer,DoseUtility,DownloadOrTransmit,ECGViewer
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static ResourceBundleprotected static Stringprotected com.pixelmed.display.StatusBarManagerFields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Frame
ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, NORMALFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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(String title) Construct a window with the default size, specified title and no property source.ApplicationFrame(String title, int closeOperation) Construct a window with the default size, specified title and no property source.ApplicationFrame(String title, String applicationPropertyFileName) Construct a window with the default size, and specified title and property sources.ApplicationFrame(String title, String applicationPropertyFileName, int closeOperation) Construct a window with the default size, and specified title and property sources.ApplicationFrame(String title, String applicationPropertyFileName, int w, int h) Construct a window with the specified size, title and property sources.ApplicationFrame(String title, String applicationPropertyFileName, int w, int h, int closeOperation) Construct a window with the specified size, title and property sources. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDo what is necessary to build an application window.protected StringGet the name of the property file set for the application.booleangetBooleanPropertyOrDefaultAndAddIt(String key, boolean defaultValue) Get the value of a boolean property from this application's property list or a default, adding it.static booleangetBooleanPropertyOrDefaultAndAddIt(Properties properties, String key, boolean defaultValue) Get the value of a boolean property from the specified property list or a default, adding it.protected static StringGet the date the package was built.intgetIntegerPropertyOrDefaultAndAddIt(String key, int defaultValue) Get the value of an integer property from this application's property list or a default, adding it.static intgetIntegerPropertyOrDefaultAndAddIt(Properties properties, String key, int defaultValue) Get the value of an integer property from the specified property list or a default, adding it.protected PropertiesGet the properties for the application that have already been loaded (seeloadProperties()).Searches for the property with the specified key in this application's property list, insisting on a value.static StringgetPropertyInsistently(Properties properties, String key) Searches for the property with the specified key in the specified property list, insisting on a value.getPropertyOrDefaultAndAddIt(String key, String defaultValue) Get the value of a property from this application's property list or a default, adding it.static StringgetPropertyOrDefaultAndAddIt(Properties properties, String key, String defaultValue) Get the value of a property from the specified property list or a default, adding it.protected static StringGet the release string for this application.protected JLabelSetup a StatusBarManager and return its StatusBar.protected voidStore the properties from the current properties file.protected static voidstatic voidFor testing.protected static StringmakePathToFileInUsersHomeDirectory(String fileName) Given a file name, such as the properties file name, make a path to it in the user's home directory.protected voidsetApplicationPropertyFileName(String applicationPropertyFileName) Set the name of the property file set for the application.static voidSetup background for UI.static voidSetup internationalized fonts if possible.static voidSetup preferred Look and Feel.protected voidstoreProperties(String comment) Store the current properties in the current properties file.protected FiletakeSnapShot(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, updateMethods inherited from class java.awt.Frame
addNotify, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, 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, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, toBack, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, list, list, paintComponents, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, hasFocus, imageUpdate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, list, list, list, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont
-
Field Details
-
resourceBundleName
-
resourceBundle
-
statusBarManager
protected com.pixelmed.display.StatusBarManager statusBarManager
-
-
Constructor Details
-
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 tosetDefaultCloseOperation()
-
ApplicationFrame
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
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 decorationcloseOperation- argument tosetDefaultCloseOperation()
-
ApplicationFrame
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 decorationapplicationPropertyFileName- the name of the properties file
-
ApplicationFrame
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 decorationapplicationPropertyFileName- the name of the properties filecloseOperation- argument tosetDefaultCloseOperation()
-
ApplicationFrame
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 decorationapplicationPropertyFileName- the name of the properties filew- widthh- height
-
ApplicationFrame
public ApplicationFrame(String title, 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 decorationapplicationPropertyFileName- the name of the properties filew- widthh- heightcloseOperation- argument tosetDefaultCloseOperation()
-
-
Method Details
-
localizeJOptionPane
protected static void localizeJOptionPane() -
getReleaseString
Get the release string for this application.
- Returns:
- the release string
-
getBuildDate
Get the date the package was built.
- Returns:
- the build date
-
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
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
Store the current properties in the current properties file.
- Parameters:
comment- the description to store as the header of the properties file- Throws:
IOException
-
getProperties
Get the properties for the application that have already been loaded (see
loadProperties()).- Returns:
- the properties
-
getApplicationPropertyFileName
Get the name of the property file set for the application.
- Returns:
- the property file name
-
setApplicationPropertyFileName
Set the name of the property file set for the application.
- Parameters:
applicationPropertyFileName- the property file name
-
getPropertyInsistently
Searches for the property with the specified key in the specified property list, insisting on a value.
- Parameters:
properties- the property list to searchkey- the property name- Throws:
Exception- if there is no such property or it has no value
-
getPropertyInsistently
Searches for the property with the specified key in this application's property list, insisting on a value.
- Parameters:
key- the property name- Throws:
Exception- if there is no such property or it has no value
-
getPropertyOrDefaultAndAddIt
public static String getPropertyOrDefaultAndAddIt(Properties properties, String key, String defaultValue) Get the value of a property from the specified property list or a default, adding it.
Adds the default property to he specified property list if not already present.
- Parameters:
properties- the property list to searchkey- the property namedefaultValue- the value to use if absent
-
getPropertyOrDefaultAndAddIt
Get the value of a property from this application's property list or a default, adding it.
Adds the default property to this application's property list if not already present.
- Parameters:
key- the property namedefaultValue- the value to use if absent
-
getBooleanPropertyOrDefaultAndAddIt
public static boolean getBooleanPropertyOrDefaultAndAddIt(Properties properties, String key, boolean defaultValue) Get the value of a boolean property from the specified property list or a default, adding it.
Adds the default property to he specified property list if not already present.
- Parameters:
properties- the property list to searchkey- the property namedefaultValue- the value to use if absent
-
getBooleanPropertyOrDefaultAndAddIt
Get the value of a boolean property from this application's property list or a default, adding it.
Adds the default property to this application's property list if not already present.
- Parameters:
key- the property namedefaultValue- the value to use if absent
-
getIntegerPropertyOrDefaultAndAddIt
public static int getIntegerPropertyOrDefaultAndAddIt(Properties properties, String key, int defaultValue) Get the value of an integer property from the specified property list or a default, adding it.
Adds the default property to he specified property list if not already present.
- Parameters:
properties- the property list to searchkey- the property namedefaultValue- the value to use if absent
-
getIntegerPropertyOrDefaultAndAddIt
Get the value of an integer property from this application's property list or a default, adding it.
Adds the default property to this application's property list if not already present.
- Parameters:
key- the property namedefaultValue- the value to use if absent
-
takeSnapShot
Store a JPEG snapshot of the specified window in the user's home directory.
- Parameters:
extent- the rectangle to take a snapshot of (typicallythis.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
For testing.
Shows an empty default sized window.
- Parameters:
arg- ignored
-