edu.umd.cs.jazz.util
Class ZBasicWindow

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--javax.swing.JWindow
                          |
                          +--edu.umd.cs.jazz.util.ZBasicWindow

public class ZBasicWindow
extends javax.swing.JWindow

ZBasicWindow defines a simple top-level Swing frame-less (i.e., Window) for use by Jazz. It is intended to be full-screen mode, and small windows to be under complete control by the application since the window doesn't have any window dressing.

This defines basic event handlers for panning and zooming with the keyboard and mouse. It also defines the Escape key to close the window.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JWindow
javax.swing.JWindow.AccessibleJWindow
 
Field Summary
protected  ZBasicComponent component
          The component in the frame that Jazz renders onto.
protected  ZEventHandler keyEventHandler
          The event handler that supports key events
static int METAL_LAF
           
protected static java.lang.String metalClassName
           
static int MOTIF_LAF
           
protected static java.lang.String motifClassName
           
protected  ZEventHandler panEventHandler
          The event handler that supports panning
protected  java.awt.event.WindowListener windowListener
          The window listener for the default basic frame that exits the application when the main window is closed.
static int WINDOWS_LAF
           
protected static java.lang.String windowsClassName
           
protected  ZEventHandler zoomEventHandler
          The event handler that supports zooming
 
Fields inherited from class javax.swing.JWindow
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ZBasicWindow()
          Creates a new top-level frame-less window with a basic Jazz scenegraph in a component within the frame.
ZBasicWindow(ZRootNode root, ZNode layer)
          Creates a new top-level frame-less window with a basic Jazz scenegraph in a component within the frame.
 
Method Summary
 ZCamera getCamera()
          Return the camera associated with the primary surface.
 ZBasicComponent getComponent()
          Return the component that the surface is attached to.
 ZEventHandler getKeyEventHandler()
          Return the key event handler.
 ZNode getLayer()
          Return the "layer".
 ZEventHandler getPanEventHandler()
          Return the pan event handler.
 ZRootNode getRoot()
          Return the root of the scenegraph.
 ZSurface getSurface()
          Return the surface.
 java.awt.event.WindowListener getWindowListener()
          Returns the window listener for the default basic frame that exits the application when the main window is closed.
 ZEventHandler getZoomEventHandler()
          Return the zoom event handler.
static void main(java.lang.String[] s)
          Simple test that creates a basic application and puts some text in the scenegraph.
 void setLookAndFeel(int laf)
          Set the Swing look and feel.
 
Methods inherited from class javax.swing.JWindow
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, windowInit
 
Methods inherited from class java.awt.Window
addNotify, addWindowListener, applyResourceBundle, applyResourceBundle, dispose, finalize, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WINDOWS_LAF

public static final int WINDOWS_LAF

METAL_LAF

public static final int METAL_LAF

MOTIF_LAF

public static final int MOTIF_LAF

windowsClassName

protected static java.lang.String windowsClassName

metalClassName

protected static java.lang.String metalClassName

motifClassName

protected static java.lang.String motifClassName

component

protected ZBasicComponent component
The component in the frame that Jazz renders onto.

panEventHandler

protected ZEventHandler panEventHandler
The event handler that supports panning

zoomEventHandler

protected ZEventHandler zoomEventHandler
The event handler that supports zooming

keyEventHandler

protected ZEventHandler keyEventHandler
The event handler that supports key events

windowListener

protected java.awt.event.WindowListener windowListener
The window listener for the default basic frame that exits the application when the main window is closed. Remove this listener to avoid having the application exit when the frame is closed.
Constructor Detail

ZBasicWindow

public ZBasicWindow()
Creates a new top-level frame-less window with a basic Jazz scenegraph in a component within the frame. The scenegraph consists of a root, a node, and a camera that looks onto that node, plus a surface that is mapped to the window. Each of the scenegraph elements can be used via the accessor functions.
See Also:
getRoot(), getSurface(), getCamera(), getLayer()

ZBasicWindow

public ZBasicWindow(ZRootNode root,
                    ZNode layer)
Creates a new top-level frame-less window with a basic Jazz scenegraph in a component within the frame. The scenegraph consists of a root, a node, and a camera that looks onto that node, plus a surface that is mapped to the window. Each of the scenegraph elements can be used via the accessor functions.

To attach a new frame to an existing scenegraph, then specify the root and layer parameters. The root should be an existing scenegraph, and the layer should be an existing layer that should be seen on this frame. A new camera and surface will be created, and the camera will be set to look at the layer. If root and layer are specified as null, then a new scenegraph will be created.

Parameters:
root - Existing root of scenegraph, or null for none
layer - Existing layer of scenegraph, or null for none
See Also:
getRoot(), getSurface(), getCamera(), getLayer()
Method Detail

getCamera

public ZCamera getCamera()
Return the camera associated with the primary surface.
Returns:
the camera

getSurface

public ZSurface getSurface()
Return the surface.
Returns:
the surface

getRoot

public ZRootNode getRoot()
Return the root of the scenegraph.
Returns:
the root

getLayer

public ZNode getLayer()
Return the "layer". That is, the single node that the camera looks onto to start.
Returns:
the node

getComponent

public ZBasicComponent getComponent()
Return the component that the surface is attached to.
Returns:
the component

getWindowListener

public java.awt.event.WindowListener getWindowListener()
Returns the window listener for the default basic frame that exits the application when the main window is closed. Remove this listener to avoid having the application exit when the frame is closed.

getPanEventHandler

public ZEventHandler getPanEventHandler()
Return the pan event handler.
Returns:
the pan event handler.

getZoomEventHandler

public ZEventHandler getZoomEventHandler()
Return the zoom event handler. *@eturn the zoom event handler.

getKeyEventHandler

public ZEventHandler getKeyEventHandler()
Return the key event handler.
Returns:
the key event handler.

setLookAndFeel

public void setLookAndFeel(int laf)
Set the Swing look and feel.
Parameters:
laf - The look and feel, can be WINDOWs_LAF, METAL_LAF, or MOTIF_LAF

main

public static void main(java.lang.String[] s)
Simple test that creates a basic application and puts some text in the scenegraph.