anecho.gui
Class JSyncFrame

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 anecho.gui.JSyncFrame
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:
MainSwingFrame

public class JSyncFrame
extends javax.swing.JFrame

The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events

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
 
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, 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
JSyncFrame(java.lang.String title)
          The JamochaMUD Frame synchroniser: JSyncFrame.java handles the synchronising of Swing frame minimize/maximize, and potentially, movement events
JSyncFrame(java.lang.String title, boolean sync, SyncFrameGroup group)
          The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events
JSyncFrame(java.lang.String title, SyncFrameGroup group)
          The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events
 
Method Summary
 void dispose()
          dispose of public class Window is handled to remove this frame from it's * registered SyncFrameGroups first before letting the super-class handle the rest
 SyncFrameGroup getSyncFrameGroup()
           
 boolean isCloseState()
          Report the "Close state" of this frame.
 boolean isGroupSync()
           
 boolean isLocked()
          Returns the "lock" state of this frame.
 boolean isSynced()
          Get the synchronisation status of this frame
 boolean isTerminated()
          Report the "termination state" of this frame
 java.lang.String paramString()
          A paramString so that other classes can identify individual SyncFrames.
 void processComponentEvent(java.awt.event.ComponentEvent event)
          This method processes Component Events, letting other frames in the group know if they have changed size or moved.
 void processWindowEvent(java.awt.event.WindowEvent event)
          This method handles the closing and iconifying of the frame, calling other frames in this group if necessary.
 void setAllStates(boolean state)
          Set the state of all the frames in this group to be the same
 void setBounds(int newX, int newY, int width, int height)
          This method is overridden to keep us up to date with the component's location
 void setBounds(java.awt.Rectangle bounds)
          setBounds is overridden to keep us up to date with the component's location
 void setCloseState(boolean state)
          Set the frame to close when the "close" icon of the frame is activated
 void setGroupSync(boolean sync)
          Set the synchronisation of the entire frame group.
 void setLocation(int newX, int newY)
          setLocation is overridden to keep us up to date with the component's location
 void setLocation(java.awt.Point newLoc)
          setBounds is overridden to keep us up to date with the component's location
 void setLock(boolean status)
          Sets the "lock" status of this frame.
 void setSync(boolean sync)
          The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events
 void setSyncFrameGroup(SyncFrameGroup group)
          Set the SyncFrameGroup for this frame
 void setTerminationState(boolean state)
          Set the "termination state" of this frame (whether it kills the JVM or not)
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, 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, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, 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, 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, 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, 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 java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

JSyncFrame

public JSyncFrame(java.lang.String title)
The JamochaMUD Frame synchroniser: JSyncFrame.java handles the synchronising of Swing frame minimize/maximize, and potentially, movement events

Parameters:
title - The title to be displayed on this frame component

JSyncFrame

public JSyncFrame(java.lang.String title,
                  SyncFrameGroup group)
The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events

Parameters:
title - The title to be displayed on this frame component.
group - The group that this JSyncFrame is to be part of.

JSyncFrame

public JSyncFrame(java.lang.String title,
                  boolean sync,
                  SyncFrameGroup group)
The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events

Parameters:
title - The title to be displayed on this frame component
sync - Indicates whether this frame is to sync with other frames in this group. true - indicates synchronisation should occur false - indicates this frame acts independently of other frames in the SyncGroup
group - The SyncGroup this frame belongs to
Method Detail

setSync

public void setSync(boolean sync)
The JamochaMUD Frame synchroniser: SyncFrame.java handles the synchronising of frame minimize/maximize, and potentially, movement events

Parameters:
sync - Indicates whether this frame is to sync with other frames in this group. true - indicates synchronisation should occur false - indicates this frame acts independently of other frames in the SyncGroup

setGroupSync

public void setGroupSync(boolean sync)
Set the synchronisation of the entire frame group. Not finished. Fix Me XXX

Parameters:
sync - true - Synchronise this frame with the rest of the group false - this frame should act independently of the other frames

isGroupSync

public boolean isGroupSync()

isSynced

public boolean isSynced()
Get the synchronisation status of this frame

Returns:
returns the boolean state of this SyncFrame's synchronisation status
See Also:
gui.SyncFrame#setSync

setSyncFrameGroup

public void setSyncFrameGroup(SyncFrameGroup group)
Set the SyncFrameGroup for this frame

Parameters:
group - This is the group this frame should belong to.

getSyncFrameGroup

public SyncFrameGroup getSyncFrameGroup()

setTerminationState

public void setTerminationState(boolean state)
Set the "termination state" of this frame (whether it kills the JVM or not)

Parameters:
state - A true state indicates that closing this SyncFrame will terminate the JVM. A false indicates this SyncFrame will simply terminate itself, leaving the JVM to run

isTerminated

public boolean isTerminated()
Report the "termination state" of this frame

Returns:
A true state indicates that the closing of this frame will terminate the JVM, a false will simply close the frame

setCloseState

public void setCloseState(boolean state)
Set the frame to close when the "close" icon of the frame is activated

Parameters:
state - A true closes the appropriate frame. A false does not close the frame when activate

isCloseState

public boolean isCloseState()
Report the "Close state" of this frame.

Returns:
true - This frame should close when it is "x"'d out false - This frame should not close when "x"'d out

processWindowEvent

public void processWindowEvent(java.awt.event.WindowEvent event)
This method handles the closing and iconifying of the frame, calling other frames in this group if necessary.

Overrides:
processWindowEvent in class javax.swing.JFrame
Parameters:
event - Our WindowEvent

processComponentEvent

public void processComponentEvent(java.awt.event.ComponentEvent event)
This method processes Component Events, letting other frames in the group know if they have changed size or moved.

Overrides:
processComponentEvent in class java.awt.Component
Parameters:
event - Our ComponentEvent.

setAllStates

public void setAllStates(boolean state)
Set the state of all the frames in this group to be the same

Parameters:
state - If true, all the frames in the group will be synchronised If false the frames will act independantly of each other.

setBounds

public void setBounds(int newX,
                      int newY,
                      int width,
                      int height)
This method is overridden to keep us up to date with the component's location

Overrides:
setBounds in class java.awt.Window
Parameters:
newX - New X-axis position for this frame.
newY - New Y-axis position for this frame.
width - Width of the component
height - Height of this component

setBounds

public void setBounds(java.awt.Rectangle bounds)
setBounds is overridden to keep us up to date with the component's location

Overrides:
setBounds in class java.awt.Window
Parameters:
bounds - The position and size of this frame

setLocation

public void setLocation(int newX,
                        int newY)
setLocation is overridden to keep us up to date with the component's location

Overrides:
setLocation in class java.awt.Component
Parameters:
newX - New X-axis position for this frame.
newY - New Y-axis position for this frame.

setLocation

public void setLocation(java.awt.Point newLoc)
setBounds is overridden to keep us up to date with the component's location

Overrides:
setLocation in class java.awt.Component
Parameters:
newLoc - New position for this frame.

dispose

public void dispose()
dispose of public class Window is handled to remove this frame from it's * registered SyncFrameGroups first before letting the super-class handle the rest

Overrides:
dispose in class java.awt.Window

paramString

public java.lang.String paramString()
A paramString so that other classes can identify individual SyncFrames.

Overrides:
paramString in class javax.swing.JFrame
Returns:
The name of the class, plus the name of the class

setLock

public void setLock(boolean status)
Sets the "lock" status of this frame. This is needed when dealing with SyncFrameGroups to prevent "stuttering". A SyncFrame becomes "locked" true by default if another SyncFrame is moved, hidden, or shown. Without the lock, certain OSes activate the other SyncFrame's events after the original event has been completed, making terrible loops. Once a locked frame has received an event, it is unlocked (set false) again.

Parameters:
status - the SyncFrame's lock status
See Also:
gui.SyncFrameGroup

isLocked

public boolean isLocked()
Returns the "lock" state of this frame.

Returns:
the state of the lock as a boolean variable
See Also:
gui.SyncFrame#setLock