NOS.gui
Class NOSWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by NOS.gui.NOSWindow
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, NOSStyleListener
Direct Known Subclasses:
NOSBorderlessWindow, NOSDialog

public class NOSWindow
extends javax.swing.JPanel
implements NOSStyleListener

See Also:
Serialized Form

Nested Class Summary
 class NOSWindow.WindowMouseAdapter
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
protected  boolean clampToDesktopBorders
           
protected  NOSButton close
           
protected static java.awt.Cursor defaultCursor
           
protected  boolean focus
           
protected  NOSButton max
           
protected  boolean maximised
           
protected  NOSButton min
           
protected  int numbuttons
           
protected  java.awt.Point restoreloc
           
protected  java.awt.Dimension restoresize
           
protected  java.awt.Color shadowColour
           
protected static java.awt.Cursor southEastResizeCursor
           
protected static java.awt.Cursor southResizeCursor
           
protected static java.awt.Cursor southWestResizeCursor
           
protected  Style style
           
protected  java.lang.String title
           
protected  java.util.Vector windowlisteners
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
 
Constructor Summary
protected NOSWindow()
          Creates a new NOSWindow object.
  NOSWindow(java.lang.String title)
          Creates a new NOSWindow object.
  NOSWindow(java.lang.String title, boolean smin, boolean smax, boolean sclose)
          Creates a new NOSWindow object.
 
Method Summary
 void addNOSWindowListener(NOSWindowListener list)
          Adds a NOSWindowListener to this window
 void close()
          Closes this window
 void drawShadow(java.awt.Graphics g)
          Draws the shadow around this window
 boolean getAlwaysOnTop()
          Returns the "Always On Top" behaviour of this window.
 java.awt.Image getBackBuffer()
          Returns the backbuffer image for this window.
 java.awt.Composite getCompositionEffect()
          Returns the composition effect to be used when rendering this window to the desktop.
 javax.swing.JPanel getContentPane()
          Returns the content pane for this window
 NOSDialog getDialog()
          Returns the currently active dialog for this window.
 java.awt.Graphics getGraphics()
          Returns the Graphics context of this window
 java.lang.String getTitle()
          Returns the title string of this window.
 boolean hasFocus()
          If this user has selected this window this function will return true.
 boolean isMaximised()
          Returns true of this window is currently maximised
 void maximise()
          Maximises this window.
 void minimise()
          Minimises this window.
 void notifyHasFocus(boolean focus)
          Called to change the focussed state of this window.
 void notifyStyleChange(Style style)
          Called to notify this window that the currently active Style has changed
 void paint(java.awt.Graphics g)
          Called to paint this window
 void removeNOSWindowListener(NOSWindowListener list)
          Removes a NOSWindowListener from this window
 void restore()
          Restores this window
 void setAlwaysOnTop(boolean onTop)
          Change the "Always On Top" behaviour of this window.
 void setCompositionEffect(java.awt.Composite composite)
          Changes the composition effect used when rendering this window to the desktop.
 void setDialog(NOSDialog dialog)
          Sets the currently active dialog for this window
 void setLocation(int x, int y)
          Sets the location of this window
 void setSize(int width, int height)
          Sets the size of this window
 void setTitle(java.lang.String title)
          Change the title string of this window
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultCursor

protected static final java.awt.Cursor defaultCursor

southResizeCursor

protected static final java.awt.Cursor southResizeCursor

southEastResizeCursor

protected static final java.awt.Cursor southEastResizeCursor

southWestResizeCursor

protected static final java.awt.Cursor southWestResizeCursor

close

protected NOSButton close

max

protected NOSButton max

min

protected NOSButton min

title

protected java.lang.String title

style

protected Style style

focus

protected boolean focus

maximised

protected boolean maximised

restoresize

protected java.awt.Dimension restoresize

restoreloc

protected java.awt.Point restoreloc

clampToDesktopBorders

protected boolean clampToDesktopBorders

windowlisteners

protected java.util.Vector windowlisteners

numbuttons

protected int numbuttons

shadowColour

protected java.awt.Color shadowColour
Constructor Detail

NOSWindow

protected NOSWindow()
Creates a new NOSWindow object.


NOSWindow

public NOSWindow(java.lang.String title)
Creates a new NOSWindow object.

Parameters:
title - The title String to be used in the title bar of this window

NOSWindow

public NOSWindow(java.lang.String title,
                 boolean smin,
                 boolean smax,
                 boolean sclose)
Creates a new NOSWindow object.

Parameters:
title - The title String to be used in the title bar of this window
smin - If true then the minimize button will be displayed
smax - If true then the maximise button will be displayed
sclose - If true then the close button will be displayed
Method Detail

paint

public void paint(java.awt.Graphics g)
Called to paint this window

Overrides:
paint in class javax.swing.JComponent
Parameters:
g - The Graphics context to use.

getGraphics

public java.awt.Graphics getGraphics()
Returns the Graphics context of this window

Overrides:
getGraphics in class javax.swing.JComponent
Returns:
The Graphics context.

setCompositionEffect

public void setCompositionEffect(java.awt.Composite composite)
Changes the composition effect used when rendering this window to the desktop.

Parameters:
composite - The new composition effect to be used.

getCompositionEffect

public java.awt.Composite getCompositionEffect()
Returns the composition effect to be used when rendering this window to the desktop.

Returns:
The composition effect to be used.

getBackBuffer

public java.awt.Image getBackBuffer()
Returns the backbuffer image for this window. Before using the returned object please be sure to synchronize on it first to avoid using it when the window is only partially drawn.

Returns:
The backbuffer Image of this window.

notifyStyleChange

public void notifyStyleChange(Style style)
Called to notify this window that the currently active Style has changed

Specified by:
notifyStyleChange in interface NOSStyleListener
Parameters:
style - The new Style object.

drawShadow

public void drawShadow(java.awt.Graphics g)
Draws the shadow around this window

Parameters:
g - The graphics context in which to draw the shadow.

setAlwaysOnTop

public void setAlwaysOnTop(boolean onTop)
Change the "Always On Top" behaviour of this window.

Parameters:
onTop - If true then the window will be placed in the "Always On Top" group of windows.

getAlwaysOnTop

public boolean getAlwaysOnTop()
Returns the "Always On Top" behaviour of this window.

Returns:
true if the window will be placed in the "Always On Top" group of windows.

setTitle

public void setTitle(java.lang.String title)
Change the title string of this window

Parameters:
title - The new title string.

getTitle

public java.lang.String getTitle()
Returns the title string of this window.

Returns:
The title string.

setDialog

public void setDialog(NOSDialog dialog)
Sets the currently active dialog for this window

Parameters:
dialog - The dialog

getDialog

public NOSDialog getDialog()
Returns the currently active dialog for this window.

Returns:
The dialog

isMaximised

public boolean isMaximised()
Returns true of this window is currently maximised

Returns:
true of this window is currently maximised

setSize

public void setSize(int width,
                    int height)
Sets the size of this window

Overrides:
setSize in class java.awt.Component
Parameters:
width - The width
height - The height

setLocation

public void setLocation(int x,
                        int y)
Sets the location of this window

Overrides:
setLocation in class java.awt.Component
Parameters:
x - X
y - Y

minimise

public void minimise()
Minimises this window.


maximise

public void maximise()
Maximises this window.


restore

public void restore()
Restores this window


close

public void close()
Closes this window


addNOSWindowListener

public void addNOSWindowListener(NOSWindowListener list)
Adds a NOSWindowListener to this window

Parameters:
list - The NOSWindowListener to be added.

removeNOSWindowListener

public void removeNOSWindowListener(NOSWindowListener list)
Removes a NOSWindowListener from this window

Parameters:
list - The NOSWindowListener to be removed.

getContentPane

public javax.swing.JPanel getContentPane()
Returns the content pane for this window

Returns:
The content pane.

hasFocus

public boolean hasFocus()
If this user has selected this window this function will return true.

Overrides:
hasFocus in class java.awt.Component
Returns:
True if the user has selected this window.

notifyHasFocus

public void notifyHasFocus(boolean focus)
Called to change the focussed state of this window.

Parameters:
focus - The new focus state.