|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--quicktime.app.display.QTCanvas
A specialized canvas which supplies access to the native graphics environment and offers expanded functionality to control its viewing or display size. The QTCanvas object can display any object which implements the Drawable interface. This Drawable object is set as the drawing client of the QTCanvas object.
The resize and alignment flags determine how the QTCanvas object acts when it has its setSize or setBounds method called. These flags allow the application to control or restrict the viewing size of a QTCanvas - generally desirable as the QuickTime client of a QTCanvas is constructed to be viewed in a particular best size or react in a desired manner when resized. The resize flags comments discuss the typically appropriate usage. If the kAnySize flag is used the QTCanvas will be resized as any other java.awt.Component.
The size of the QTCanvas and its Drawable client are kept synchronized. The actual size of the QTCanvas is determined by the size of its Drawable client when it is set (which becomes its "best" viewing size), the resize and alignement flag settings, and the size of the QTCanvas' java.awt.Container parent. The client, the resize and alignment flags determine how a QTCanvas reacts to a setBounds or setSize call - any resize flag other than the kAnySize flag will result in the QTCanvas' actual size being arbitrated with the best viewing size of its client. Thus in many cases the calls to setSize and setBounds on a QTCanvas object are requests and may not result in the QTCanvas actually being resized to that requested size.
When a QTCanvas' client is set the size of the client's current size is used by the QTCanvas to indicate that this is that client's best viewing size. By default (and an application can change this) this will also become the preferred size of the QTCanvas. This size is cached by the QTCanvas and used when it is responding to resize requests from its parent Container (for instance, the user resizes the window the QTCanvas is in).
If an application changes the size of the client after it has been set - for instance a Movie client is edited and the viewing area of the movie is now different - then the application must inform the QTCanvas that the client's best size is changed, before resizing the QTCanvas itself. This ensures that the QTCanvas will resize and redraw the client correctly, avoiding unwanted scaling of the client:
// application changes the actual display size of a Movie through // adding a video track to a movie that only had a sound track // this means that the movie client has now a best size that // that is different when it was originally set as the client of this QTCanvas myQTCanvas.clientChanged (r.getWidth(), r.getHeight()); myQTCanvas.invalidate(); //resize the QTCanvas' parent container so that the changed viewing conditions of the //client will be seen. //pack() is appropriate, as is getParent().setSize(), or getParent().setBounds() //The application could also just validate the parent if the parent should not change size
Once the application has notified the canvas that the client's best viewing size has changed the QTCanvas will correctly respond to the any new sizes that are given to it by it parent's layout manager or resizing actions.
In most interactions between a QTCanvas and its client this explicit resizing of the client is not required as all of the Drawable clients are able to scale themselves appropriately to a different display size. It is only required when the client's size itself has changed.
Drawable,
Serialized Form| Field Summary | |
static int |
kAspectResize
Deprecated. since QTJava 6.1 |
static int |
kFreeResize
Deprecated. since QTJava 6.1 |
static int |
kHorizontalResize
Deprecated. since QTJava 6.1 |
static int |
kInitialSize
Deprecated. since QTJava 6.1 |
static int |
kInitialSizeNoResize
Deprecated. since QTJava 6.1 |
static int |
kIntegralResize
Deprecated. since QTJava 6.1 |
static int |
kPerformanceResize
Deprecated. since QTJava 6.1 |
static int |
kVerticalResize
Deprecated. since QTJava 6.1 |
| 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 | |
QTCanvas()
Deprecated. since QTJava 6.1 |
|
QTCanvas(int resizeFlag,
float xAlignment,
float yAlignment)
Deprecated. since QTJava 6.1 |
|
| Method Summary | |
void |
addNotify()
Deprecated. since QTJava 6.1 |
void |
addQTClientListener(java.awt.event.ComponentListener e)
Deprecated. since QTJava 6.1 |
void |
clientChanged(java.awt.Dimension bestSize)
Deprecated. since QTJava 6.1 |
void |
clientChanged(int bestWidth,
int bestHeight)
Deprecated. since QTJava 6.1 |
protected void |
finalize()
Deprecated. |
float |
getAlignmentX()
Deprecated. since QTJava 6.1 |
float |
getAlignmentY()
Deprecated. since QTJava 6.1 |
java.awt.Dimension |
getBestSize()
Deprecated. since QTJava 6.1 |
Drawable |
getClient()
Deprecated. since QTJava 6.1 |
java.awt.Dimension |
getMaximumSize()
Deprecated. since QTJava 6.1 |
java.awt.Dimension |
getMinimumSize()
Deprecated. since QTJava 6.1 |
NativeGraphics |
getNativeGraphics()
Deprecated. since QTJava 6.1 |
java.awt.Point |
getNGLocation()
Deprecated. since QTJava 6.1 |
QDGraphics |
getPort()
Deprecated. since QTJava 6.1 |
java.awt.Dimension |
getPreferredSize()
Deprecated. since QTJava 6.1 |
int |
getResizeFlag()
Deprecated. since QTJava 6.1 |
boolean |
isFocusTraversable()
Deprecated. since QTJava 6.1 |
void |
paint(java.awt.Graphics g)
Deprecated. since QTJava 6.1 |
void |
removeClient()
Deprecated. since QTJava 6.1 |
void |
removeNotify()
Deprecated. since QTJava 6.1 |
void |
removeQTClientListener(java.awt.event.ComponentListener e)
Deprecated. since QTJava 6.1 |
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 xAlignment,
float yAlignment)
Deprecated. since QTJava 6.1 |
void |
setAlignmentX(float x)
Deprecated. |
void |
setAlignmentY(float y)
Deprecated. |
void |
setBounds(int x,
int y,
int width,
int height)
Deprecated. since QTJava 6.1 |
void |
setClient(Drawable client,
boolean layoutFlag)
Deprecated. since QTJava 6.1 |
void |
setClient(Drawable client,
QDRect initialBounds)
Deprecated. since QTJava 6.1 |
void |
setMaximumSize(java.awt.Dimension maxSize)
Deprecated. since QTJava 6.1 |
void |
setMaximumSize(int width,
int height)
Deprecated. since QTJava 6.1 |
void |
setMinimumSize(java.awt.Dimension minSize)
Deprecated. since QTJava 6.1 |
void |
setMinimumSize(int width,
int height)
Deprecated. since QTJava 6.1 |
void |
setPreferredSize(java.awt.Dimension prefSize)
Deprecated. since QTJava 6.1 |
void |
setPreferredSize(int width,
int height)
Deprecated. since QTJava 6.1 |
void |
setResizeFlag(int rFlag)
Deprecated. since QTJava 6.1 |
void |
setSize(java.awt.Dimension dim)
Deprecated. since QTJava 6.1 |
void |
setSize(int width,
int height)
Deprecated. since QTJava 6.1 |
void |
setVisible(boolean b)
Deprecated. since QTJava 6.1 |
java.lang.String |
toString()
Deprecated. since QTJava 6.1 |
QDPoint |
translatePoint(int x,
int y)
Deprecated. since QTJava 6.1 |
void |
update(java.awt.Graphics g)
Deprecated. since QTJava 6.1 |
| Methods inherited from class java.awt.Canvas |
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int kIntegralResize
public static final int kInitialSize
public static final int kFreeResize
public static final int kAspectResize
public static final int kPerformanceResize
public static final int kHorizontalResize
public static final int kVerticalResize
public static final int kInitialSizeNoResize
| Constructor Detail |
public QTCanvas()
public QTCanvas(int resizeFlag,
float xAlignment,
float yAlignment)
resizeFlag - the resize control settingxAlignment - a value between 0 and 1 that sets the position of the drawable client within the
space that AWT will give to the canvas when layed out. 0 means left, 1 means right, 0.5 means centre.yAlignment - a value between 0 and 1 that sets the position of the drawable client within the
space that AWT will give to the canvas when layed out. 0 means top, 1 means bottom, 0.5 means centre.| Method Detail |
public final QDGraphics getPort()
throws QTUnknownOSException,
NativeGraphicsException
QTUnknownOSException - if the current operating system is unknown to QuickTime
quicktime.NativeGraphicsException - if there was a problem initialising the NativeGraphics environment
NativeGraphicsException
public final java.awt.Point getNGLocation()
throws QTUnknownOSException,
NativeGraphicsException
QTUnknownOSException
NativeGraphicsExceptionpublic final NativeGraphics getNativeGraphics()
public final QDPoint translatePoint(int x,
int y)
throws QTUnknownOSException,
NativeGraphicsException
x - the x locationy - the y location
QTUnknownOSException
NativeGraphicsExceptionpublic final void removeClient()
public void setClient(Drawable client,
boolean layoutFlag)
throws QTException
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
client - a Drawable object - if null the method will remove the clientlayoutFlag - 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.
QTException
public void setClient(Drawable client,
QDRect initialBounds)
throws QTException
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
client - a Drawable object - if null the method will remove the clientinitialBounds - the best size of the client
QTExceptionpublic final Drawable getClient()
public void setAlignment(float xAlignment,
float yAlignment)
Alignment Positioning works like this:
xAlignment - a float between 0.0 and 1.0 representing the x position alignmentyAlignment - a float between 0.0 and 1.0 representing the y position alignmentpublic final void setAlignmentX(float x)
* @deprecated since QTJava 6.1public final void setAlignmentY(float y)
* @deprecated since QTJava 6.1public float getAlignmentX()
getAlignmentX in class java.awt.Componentpublic float getAlignmentY()
getAlignmentY in class java.awt.Componentpublic void setResizeFlag(int rFlag)
rFlag - the new value for the resizeFlagpublic int getResizeFlag()
public void setMinimumSize(java.awt.Dimension minSize)
minSize - a Dimension object
public void setMinimumSize(int width,
int height)
width - the minimum widthheight - the minimum heightpublic java.awt.Dimension getMinimumSize()
getMinimumSize in class java.awt.Componentpublic java.awt.Dimension getBestSize()
clientChangedpublic void clientChanged(java.awt.Dimension bestSize)
An application only needs to call this if the display characteristics of the client have been changed. For instance, the client is a movie and some of the visual tracks of this movie have been disabled, or a new video track was added. Thus the movie itself has changed its best size and the application must use this method to notify the QTCanvas that the client's best size has changed.
This will not effect the display area of the QTCanvas, the application should invalidate the QTCanvas and re-layout the parent container to have this change take effect. getBestSize() returns this newly notified size.
In the normal operation of a QTCanvas and its client there is no need for an application to use this method.
bestSize - the client's new best width and height
public void clientChanged(int bestWidth,
int bestHeight)
An application only needs to call this if the display characteristics of the client have been changed. For instance, the client is a movie and some of the visual tracks of this movie have been disabled, or a new video track was added. Thus the movie itself has changed its best size and the application must use this method to notify the QTCanvas that the client's best size has changed.
This will not effect the display area of the QTCanvas, the application should invalidate the QTCanvas and re-layout the parent container to have this change take effect. getBestSize() returns this newly notified size.
In the normal operation of a QTCanvas and its client there is no need for an application to use this method.
bestWidth - the client's new best widthbestHeight - the client's new actual heightpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class java.awt.Componentpublic void setPreferredSize(java.awt.Dimension prefSize)
public void setPreferredSize(int width,
int height)
width - the minimum widthheight - the minimum heightpublic boolean isFocusTraversable()
isFocusTraversable in class java.awt.Componentpublic void setMaximumSize(java.awt.Dimension maxSize)
maxSize - a Dimension object
public void setMaximumSize(int width,
int height)
width - the minimum widthheight - the minimum heightpublic java.awt.Dimension getMaximumSize()
getMaximumSize in class java.awt.Componentpublic void setSize(java.awt.Dimension dim)
setSize in class java.awt.Componentdim - a Dimension object with the new width and height
public void setSize(int width,
int height)
setSize in class java.awt.Componentwidth - the width, in pixels, to make this componentheight - the height, in pixels, to make this component
public final void reshape(int x,
int y,
int width,
int height)
setBounds(int, int, int, int).
reshape in class java.awt.Component
public final void setBounds(int x,
int y,
int width,
int height)
setBounds in class java.awt.Componentx - the x coordinate, in pixels, relative to the parent of this
componenty - the y coordinate, in pixels, relative to the parent of this
componentwidth - the width, in pixels, to make this componentheight - the height, in pixels, to make this componentpublic void paint(java.awt.Graphics g)
paint in class java.awt.Canvaspublic void update(java.awt.Graphics g)
update in class java.awt.Canvaspublic void setVisible(boolean b)
setVisible in class java.awt.Componentb - if true canvas is visible, if false then its notpublic void addQTClientListener(java.awt.event.ComponentListener e)
e - the ComponentListenerpublic void removeQTClientListener(java.awt.event.ComponentListener e)
e - the ComponentListeneraddQTClientListenerpublic void addNotify()
addNotify in class java.awt.Canvaspublic void removeNotify()
removeNotify in class java.awt.Componentpublic java.lang.String toString()
toString in class java.awt.Component
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||