Graphics2D Actor API

g2d.mwa
Class MWAFrame

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 g2d.swing.IOPFrame
                          extended by g2d.mwa.MWAFrame
All Implemented Interfaces:
ControlListener, ComponentListener, WindowListener, ImageObserver, MenuContainer, Serializable, Comparable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class MWAFrame
extends IOPFrame
implements ControlListener, Comparable, ComponentListener, WindowListener

Implements a window in an Multi-Window Application. One can build up a hierachy of MWA windows using the notion of a parent window at object creation time.

Note: This class has a natural ordering based on the title of the frame that is inconsistent with equals.

Author:
linda
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static Dimension initialSize
           
protected  JMenu windowMenu
           
 
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
MWAFrame(String title)
          Creates this frame with the given title.
MWAFrame(String title, int hgap, int vgap)
          Creates this frame with the given title and sets gaps of layout manager of the content pane.
MWAFrame(String title, int hgap, int vgap, MWAFrame parent)
          Creates this frame with the given title and sets gaps of layout manager and assigns a given parent.
MWAFrame(String title, MWAFrame parent)
          Creates this frame with the given title and with a given parent.
 
Method Summary
 void close()
          Called when MWAControl wants to shut-down.
 int compareTo(Object o)
           
 void componentHidden(ComponentEvent event)
           
 void componentMoved(ComponentEvent event)
           
 void componentResized(ComponentEvent event)
           
 void componentShown(ComponentEvent event)
           
 MWAFrame[] getChildrenFrames()
          Obtain array of frames that are children of this frame.
static Dimension getInitialSize()
           
 JMenuBar getJMenuBar()
          Get menu bar without the "Window" menu.
 MWAFrame getParentFrame()
          Obtain parent frame of this frame.
 MWAFrame getTopFrame()
          Walks up the ancestors of this frame until one is found that doesn't have a parent.
 void setDefaultCloseOperation(int i)
          Do not allow users of this class to override default close operation.
static void setInitialSize(Dimension initialSize)
           
 void setJMenuBar(JMenuBar menubar)
          Set menu bar and append the "Window" menu at end.
 void setTitle(String s)
           
 void updateWindows()
          Called when the population of windows controlled by MWAControl changes.
 void windowActivated(WindowEvent event)
           
 void windowClosed(WindowEvent event)
           
 void windowClosing(WindowEvent event)
           
 void windowDeactivated(WindowEvent event)
           
 void windowDeiconified(WindowEvent event)
           
 void windowIconified(WindowEvent event)
           
 void windowOpened(WindowEvent event)
           
 
Methods inherited from class g2d.swing.IOPFrame
add, add, add, getScreenSize, main, setSize, setSize
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, 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, paint, 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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

initialSize

protected static Dimension initialSize

windowMenu

protected JMenu windowMenu
Constructor Detail

MWAFrame

public MWAFrame(String title)
Creates this frame with the given title.

Parameters:
title - String with title to be used for window
See Also:
IOPFrame.IOPFrame(String)

MWAFrame

public MWAFrame(String title,
                int hgap,
                int vgap)
Creates this frame with the given title and sets gaps of layout manager of the content pane.

Parameters:
title - String with title to be used for window
hgap - number of pixels used as horizontal gap
vgap - number of pixels used as vertical gap
See Also:
IOPFrame.IOPFrame(String, int, int)

MWAFrame

public MWAFrame(String title,
                MWAFrame parent)
Creates this frame with the given title and with a given parent.

Parameters:
title - String with title to be used for window
parent - MWAFrame that is the parent of this frame

MWAFrame

public MWAFrame(String title,
                int hgap,
                int vgap,
                MWAFrame parent)
Creates this frame with the given title and sets gaps of layout manager and assigns a given parent.

Parameters:
title - String with title to be used for window
hgap - number of pixels used as horizontal gap
vgap - number of pixels used as vertical gap
parent - MWAFrame that is the parent of this frame
Method Detail

getParentFrame

public MWAFrame getParentFrame()
Obtain parent frame of this frame. May be null if this frame does not have a parent.

Returns:
MWAFrame that is the parent of this frame (may be null)

getTopFrame

public MWAFrame getTopFrame()
Walks up the ancestors of this frame until one is found that doesn't have a parent. Returns that frame.

Returns:
Frame that is ancestor of this one and does not have any parent

getChildrenFrames

public MWAFrame[] getChildrenFrames()
Obtain array of frames that are children of this frame. The resulting array may be of lenght 0.

Returns:
Array of frames that are children

getInitialSize

public static Dimension getInitialSize()

setInitialSize

public static void setInitialSize(Dimension initialSize)

setTitle

public void setTitle(String s)
Overrides:
setTitle in class Frame

setDefaultCloseOperation

public void setDefaultCloseOperation(int i)
Do not allow users of this class to override default close operation.

Overrides:
setDefaultCloseOperation in class JFrame
Parameters:
i - (not used)

getJMenuBar

public JMenuBar getJMenuBar()
Get menu bar without the "Window" menu.

Overrides:
getJMenuBar in class JFrame

setJMenuBar

public void setJMenuBar(JMenuBar menubar)
Set menu bar and append the "Window" menu at end. If null is given, new menu bar will only contain the "Window" menu.

Overrides:
setJMenuBar in class JFrame
Parameters:
menubar - JMenuBar to be used for this frame (without "Window" menu); can be null

updateWindows

public void updateWindows()
Description copied from interface: ControlListener
Called when the population of windows controlled by MWAControl changes.

Specified by:
updateWindows in interface ControlListener

close

public void close()
Description copied from interface: ControlListener
Called when MWAControl wants to shut-down.

Specified by:
close in interface ControlListener

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

componentResized

public void componentResized(ComponentEvent event)
Specified by:
componentResized in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent event)
Specified by:
componentMoved in interface ComponentListener

componentShown

public void componentShown(ComponentEvent event)
Specified by:
componentShown in interface ComponentListener

componentHidden

public void componentHidden(ComponentEvent event)
Specified by:
componentHidden in interface ComponentListener

windowOpened

public void windowOpened(WindowEvent event)
Specified by:
windowOpened in interface WindowListener

windowClosing

public void windowClosing(WindowEvent event)
Specified by:
windowClosing in interface WindowListener

windowClosed

public void windowClosed(WindowEvent event)
Specified by:
windowClosed in interface WindowListener

windowIconified

public void windowIconified(WindowEvent event)
Specified by:
windowIconified in interface WindowListener

windowDeiconified

public void windowDeiconified(WindowEvent event)
Specified by:
windowDeiconified in interface WindowListener

windowActivated

public void windowActivated(WindowEvent event)
Specified by:
windowActivated in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent event)
Specified by:
windowDeactivated in interface WindowListener

Graphics2D Actor API