Package diva.gui

Class ApplicationContext

  • All Implemented Interfaces:
    AppContext, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    Direct Known Subclasses:
    BasicFrame

    public class ApplicationContext
    extends javax.swing.JFrame
    implements AppContext
    A context for an application in the diva.gui infrastructure. This class represents an AppContext as a JFrame. Generally, all this class does is to pipe the AppContext method through to the appropriate method in the JFrame class. In addition, a listener is attached to the frame that fires the context's exit action when a WINDOW_CLOSING event is created. In this class, the default exit action kills the JVM. This class does not contain a menu bar or a toolbar by default.
    Version:
    $Id$
    Author:
    Steve Neuendorffer, Michael Shilman, John Reekie
    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 inherited from class javax.swing.JFrame

        accessibleContext, 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 java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface javax.swing.WindowConstants

        DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
    • Constructor Summary

      Constructors 
      Constructor Description
      ApplicationContext()
      Create a new ApplicationContext.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.Action getExitAction()
      Return the action that is called back when the user exits the app.
      java.awt.Image getIconImage()
      Get the image that represents this frame.
      javax.swing.JMenuBar getJMenuBar()
      Return the menu bar that the container uses.
      java.lang.String getTitle()
      Return the title of the context.
      boolean isVisible()
      Return whether or not the frame is visible.
      java.awt.Component makeComponent()
      Return "this" as a component.
      void setExitAction​(javax.swing.Action exitAction)
      Set the action that is called back when the user exits the app.
      void setIconImage​(java.awt.Image image)
      Set the icon that represents this frame.
      void setJMenuBar​(javax.swing.JMenuBar menu)
      Set the menu bar that the container uses.
      void setTitle​(java.lang.String title)
      Set the title of the context.
      void setVisible​(boolean visible)
      Set the frame's visibility.
      void showStatus​(java.lang.String status)
      Show the given status string at the bottom of the context.
      • Methods inherited from class javax.swing.JFrame

        addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Frame

        addNotify, getCursorType, getExtendedState, getFrames, getMaximizedBounds, getMenuBar, getState, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, 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, 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, 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
      • Methods inherited from interface javax.swing.RootPaneContainer

        getContentPane, getGlassPane, getLayeredPane, getRootPane, setContentPane, setGlassPane, setLayeredPane
    • Constructor Detail

      • ApplicationContext

        public ApplicationContext()
        Create a new ApplicationContext. Add a hook to the frame that will cause the exit action to be fired when a user attempts to close the window. Set the default close operation of the frame to be DO_NOTHING_ON_CLOSE, since this is handled by the default exit action.
    • Method Detail

      • getExitAction

        public javax.swing.Action getExitAction()
        Return the action that is called back when the user exits the app.
        Specified by:
        getExitAction in interface AppContext
      • getIconImage

        public java.awt.Image getIconImage()
        Get the image that represents this frame.
        Specified by:
        getIconImage in interface AppContext
        Overrides:
        getIconImage in class java.awt.Frame
      • getTitle

        public java.lang.String getTitle()
        Return the title of the context.
        Specified by:
        getTitle in interface AppContext
        Overrides:
        getTitle in class java.awt.Frame
      • getJMenuBar

        public javax.swing.JMenuBar getJMenuBar()
        Return the menu bar that the container uses.
        Specified by:
        getJMenuBar in interface AppContext
        Overrides:
        getJMenuBar in class javax.swing.JFrame
      • isVisible

        public boolean isVisible()
        Return whether or not the frame is visible.
        Specified by:
        isVisible in interface AppContext
        Overrides:
        isVisible in class java.awt.Component
      • makeComponent

        public java.awt.Component makeComponent()
        Return "this" as a component.
        Specified by:
        makeComponent in interface AppContext
      • showStatus

        public void showStatus​(java.lang.String status)
        Show the given status string at the bottom of the context. This base class does nothing.
        Specified by:
        showStatus in interface AppContext
      • setVisible

        public void setVisible​(boolean visible)
        Set the frame's visibility.
        Specified by:
        setVisible in interface AppContext
        Overrides:
        setVisible in class java.awt.Window
      • setExitAction

        public void setExitAction​(javax.swing.Action exitAction)
        Set the action that is called back when the user exits the app.
        Specified by:
        setExitAction in interface AppContext
      • setTitle

        public void setTitle​(java.lang.String title)
        Set the title of the context.
        Specified by:
        setTitle in interface AppContext
        Overrides:
        setTitle in class java.awt.Frame
      • setIconImage

        public void setIconImage​(java.awt.Image image)
        Set the icon that represents this frame.
        Specified by:
        setIconImage in interface AppContext
        Overrides:
        setIconImage in class javax.swing.JFrame
      • setJMenuBar

        public void setJMenuBar​(javax.swing.JMenuBar menu)
        Set the menu bar that the container uses.
        Specified by:
        setJMenuBar in interface AppContext
        Overrides:
        setJMenuBar in class javax.swing.JFrame