quicktime.app.display
Class JQTCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--quicktime.app.display.JQTCanvas
All Implemented Interfaces:
DrawingListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JQTCanvas
extends javax.swing.JComponent
implements DrawingListener

This is a Lightweight version of the JQTCanvas class designed for use with Swing Because it is strictly lightweight, and has no native peer, you can only have client classes that do not use a controller such as the Compositor class and MoviePlayer. QuickTime cannot render controllers in an offscreen buffer.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static boolean flashScaling
           
 QTImageProducer ip
           
static int kAspectResize
          Use this flag if the client can be resized to any size which preserves the initial aspect ratio.
static int kFreeResize
          Use this flag if the client can be resized to any size >= the minimum and <= the maximum.
static int kHorizontalResize
          Use this flag to allow the client's horizontal aspect to be any size, but the vertical axis will be the intial size of smaller.
static int kInitialSize
          Use this flag if the client should revert to its initially specified size.
static int kInitialSizeNoResize
          Use this flag specify that the client cannot be resized
static int kIntegralResize
          Use this flag if the client should maintain the aspect size of its original dimensions but grow bigger by integral increments (2x, 3x, 4x, etc.)
static int kPerformanceResize
          Use this flag if the client can be resized to any size which is a factor of 2 of the initial size.
static int kVerticalResize
          Use this flag to allow the client's vertical aspect to be any size, but the horizontal axis will be the intial size of smaller.
static boolean useMacOSXAcceleration
           
 
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
JQTCanvas()
          Default Constructor for JQTCanvas
JQTCanvas(int resizeFlag, float xAlignment, float yAlignment)
           
 
Method Summary
 void addQTClientListener(java.awt.event.ComponentListener e)
          A ComponentListener and ComponentEvent are used to listen to these types of events that occur to the QTCanvas' client - ie.
 java.awt.Image createImage(java.awt.image.ImageProducer producer)
           
 void drawingComplete(QTDrawable drawable)
          Called when a client is finished drawing and the canvas needs to be updated
 int getResizeFlag()
          Returns the current setting of the resize flag being used.
 boolean isFlashScaling()
           
 void paint(java.awt.Graphics g)
          This method is invoked by Swing to draw this component
 void removeClient()
          Removes the current client, a drawable object, from the canvas.
 void removeQTClientListener(java.awt.event.ComponentListener e)
          Remove a previously registered ComponentListener that is listening to events that occur with the QTCanvas' QTDrawable client.
 void reshape(int x, int y, int width, int height)
          Deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).
 void setAlignment(float x, float y)
           
 void setBounds(int x, int y, int width, int height)
          Moves and resizes this component.
 void setBounds(java.awt.Rectangle r)
          Moves and resizes this component to conform to the new bounding rectangle r.
 void setClient(QTDrawable drawable, boolean layoutFlag)
          Associates a new client, a Drawable object, with this JQTCanvas.
 void setClient(QTDrawable cl, QDRect initialBounds)
          Associates a new client, a Drawable object, with this JQTCanvas.
 void setFlashScaling(boolean scale)
           
 void setResizeFlag(int rFlag)
          Reset the resize flag and re-layout the component.
 void setSize(java.awt.Dimension dim)
          Resizes the JQTCanvas object to the specified parameters.
 void setSize(int width, int height)
          Resizes the JQTCanvas object, as well as the associated Drawable object.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kIntegralResize

public static final int kIntegralResize
Use this flag if the client should maintain the aspect size of its original dimensions but grow bigger by integral increments (2x, 3x, 4x, etc.)

kInitialSize

public static final int kInitialSize
Use this flag if the client should revert to its initially specified size. The client can be made smaller (using an aspect setting) but can be no larger than its initial size. The JQTCanvas takes this initial size as the best viewing size for its client.

kFreeResize

public static final int kFreeResize
Use this flag if the client can be resized to any size >= the minimum and <= the maximum.

kAspectResize

public static final int kAspectResize
Use this flag if the client can be resized to any size which preserves the initial aspect ratio.

kPerformanceResize

public static final int kPerformanceResize
Use this flag if the client can be resized to any size which is a factor of 2 of the initial size.

kHorizontalResize

public static final int kHorizontalResize
Use this flag to allow the client's horizontal aspect to be any size, but the vertical axis will be the intial size of smaller. This is a good setting for QT VR content.

kVerticalResize

public static final int kVerticalResize
Use this flag to allow the client's vertical aspect to be any size, but the horizontal axis will be the intial size of smaller.

kInitialSizeNoResize

public static final int kInitialSizeNoResize
Use this flag specify that the client cannot be resized

flashScaling

public static boolean flashScaling

useMacOSXAcceleration

public static boolean useMacOSXAcceleration

ip

public QTImageProducer ip
Constructor Detail

JQTCanvas

public JQTCanvas()
Default Constructor for JQTCanvas

JQTCanvas

public JQTCanvas(int resizeFlag,
                 float xAlignment,
                 float yAlignment)
Method Detail

paint

public void paint(java.awt.Graphics g)
This method is invoked by Swing to draw this component
Overrides:
paint in class javax.swing.JComponent

setFlashScaling

public void setFlashScaling(boolean scale)

isFlashScaling

public boolean isFlashScaling()

setClient

public void setClient(QTDrawable drawable,
                      boolean layoutFlag)
               throws QTException
Associates a new client, a Drawable object, with this JQTCanvas. The flag determines if awt will perform a layout and how the client will be integrated with the canvas. If the flag is false then the new client will take on the current size and position of the canvas. If the flag is true, then awt will layout the canvas again, using the initial size of the client and the resize flags to resize the canvas and its client.

The size of the client when this method is called is used to ascertain the best size for viewing this client's media.

This method can throw a number of exceptions:
QTUnknownOSException the application is trying to run on a platform that is not supported by QuickTime
NativeGraphicsException the native graphics environment is not initialised
QTException or subclass - there was a problem within QuickTime itself in dealing with this client

Parameters:
client - a Drawable object - if null the method will remove the client
layoutFlag - if true java.awt will re-layout the canvas, if false the client will fit into the existing state (display size, etc) of the canvas, disregarding any resize that might have occured to honour the layout flag setting with respect to the different size of the new client. Keep in mind that only controllerless clients are valid

setClient

public void setClient(QTDrawable cl,
                      QDRect initialBounds)
               throws QTException
Associates a new client, a Drawable object, with this JQTCanvas. It will use existing alignment and resize restrictions.

This method can throw a number of exceptions:
QTUnknownOSException the application is trying to run on a platform that is not supported by QuickTime
NativeGraphicsException the native graphics environment is not initialised
QTException or subclass - there was a problem within QuickTime itself in dealing with this client

Parameters:
client - a Drawable object - if null the method will remove the client
initialBounds - the best size of the client Keep in mind that only controllerless clients are valid

removeClient

public final void removeClient()
Removes the current client, a drawable object, from the canvas.

createImage

public java.awt.Image createImage(java.awt.image.ImageProducer producer)
Overrides:
createImage in class java.awt.Component

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.
Overrides:
setBounds in class java.awt.Component
Parameters:
x - the new x-coordinate of this component
y - the new y-coordinate of this component
width - the new width of this component
height - the new height of this component
See Also:
setBounds(Rectangle r)

setBounds

public void setBounds(java.awt.Rectangle r)
Moves and resizes this component to conform to the new bounding rectangle r. This component's new position is specified by r.x and r.y, and its new size is specified by r.width and r.height
Overrides:
setBounds in class java.awt.Component

setSize

public void setSize(java.awt.Dimension dim)
Resizes the JQTCanvas object to the specified parameters.
Overrides:
setSize in class java.awt.Component
Parameters:
dim - a Dimension object with the new width and height

setSize

public void setSize(int width,
                    int height)
Resizes the JQTCanvas object, as well as the associated Drawable object.
Overrides:
setSize in class java.awt.Component
Parameters:
width - the width, in pixels, to make this component
height - the height, in pixels, to make this component

reshape

public final void reshape(int x,
                          int y,
                          int width,
                          int height)
Deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).

Overrides:
reshape in class javax.swing.JComponent

setAlignment

public void setAlignment(float x,
                         float y)

setResizeFlag

public void setResizeFlag(int rFlag)
Reset the resize flag and re-layout the component.
Parameters:
rFlag - the new value for the resizeFlag

getResizeFlag

public int getResizeFlag()
Returns the current setting of the resize flag being used.
Returns:
the resize flag value

drawingComplete

public void drawingComplete(QTDrawable drawable)
Called when a client is finished drawing and the canvas needs to be updated
Specified by:
drawingComplete in interface DrawingListener
Following copied from interface: quicktime.app.display.DrawingListener
Parameters:
drawable - the drawable which drawing has just been completed upon
Returns:
an error code or zero if no error
See Also:
quicktime.app.display

addQTClientListener

public void addQTClientListener(java.awt.event.ComponentListener e)
A ComponentListener and ComponentEvent are used to listen to these types of events that occur to the QTCanvas' client - ie. when the QTCanvas' client is resized, moved, shown or hidden. These events generally occur in conjunction with the Component events they mirror - with some exceptions:

removeQTClientListener

public void removeQTClientListener(java.awt.event.ComponentListener e)
Remove a previously registered ComponentListener that is listening to events that occur with the QTCanvas' QTDrawable client.
Parameters:
e - the ComponentListener
See Also:
addQTClientListener