|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel org.opensourcephysics.display.DrawingPanel org.opensourcephysics.display.InteractivePanel org.opensourcephysics.media.core.VideoPanel
public class VideoPanel
This is an interactive drawing panel with a video player. It can draw videos and other Trackable objects in either imagespace or worldspace. When drawing in imagespace, the image reference frame (ie the image itself) is fixed. When drawing in worldspace, the world reference frame is fixed. The image reference frame defines positions in pixel units relative to the upper left corner of a video image--ie, the UL corner of a 320 x 240 video is at (0.0, 0.0) and the LR corner is at (320.0, 240.0). When drawing in imagespace, non-Trackable objects are not drawn.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractivePanel |
---|
InteractivePanel.IADMouseController |
Nested classes/interfaces inherited from class org.opensourcephysics.display.DrawingPanel |
---|
DrawingPanel.ZoomBox |
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 | |
---|---|
boolean |
changed
set to true when this panel has been changed, false when saved |
protected ImageCoordSystem |
coords
|
protected java.io.File |
dataFile
|
java.lang.String |
defaultFileName
default file name used for initial saveAs |
protected static int |
defaultHeight
|
protected static int |
defaultWidth
|
protected boolean |
drawingInImageSpace
|
protected java.util.Map<java.lang.String,java.lang.Class<? extends Filter>> |
filterClasses
|
protected double |
imageBorder
|
protected double |
imageHeight
|
protected double |
imageWidth
|
protected TextPanel |
messagePanel
|
protected TextPanel |
mousePanel
|
protected VideoPlayer |
player
|
protected boolean |
playerVisible
|
protected java.awt.geom.Point2D |
pt
|
protected Video |
video
|
protected double |
xOffset
|
protected double |
yOffset
|
Fields inherited from class org.opensourcephysics.display.InteractivePanel |
---|
containsInteractive, interactive, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, mouseAction, mouseEvent |
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 | |
---|---|
VideoPanel()
Constructs a blank VideoPanel with a player. |
|
VideoPanel(Video video)
Constructs a VideoPanel with a video and player. |
Method Summary | ||
---|---|---|
void |
addDrawable(Drawable drawable)
Adds a drawable object to the drawable list. |
|
void |
addFilter(java.lang.Class<? extends Filter> filterClass)
Adds a video filter class to the map of available filters. |
|
protected boolean |
checkImage()
Overrides DrawingPanel checkImage method so offscreenImage will not include the videoPlayer. |
|
void |
clear()
Removes all drawable objects except the video. |
|
ImageCoordSystem |
getCoords()
Gets the current image coordinate system used for drawing. |
|
java.io.File |
getDataFile()
Gets the file where data is saved. |
|
java.util.ArrayList<Drawable> |
getDrawables()
Overrides DrawingPanel getDrawables method. |
|
java.lang.String |
getFilePath()
Gets the default path for the saveAs method. |
|
java.util.Map<java.lang.String,java.lang.Class<? extends Filter>> |
getFilters()
Gets the map of available video filters. |
|
int |
getFrameNumber()
Gets the current frame number. |
|
double |
getImageBorder()
Gets the image border. |
|
double |
getImageHeight()
Gets the image height in image units (1.0 unit/pixel). |
|
double |
getImageWidth()
Gets the image width in image units. |
|
static XML.ObjectLoader |
getLoader()
Returns an XML.ObjectLoader to save and load data for this object. |
|
VideoPlayer |
getPlayer()
Gets the video player. |
|
int |
getStepNumber()
Gets the current step number. |
|
Video |
getVideo()
Gets the video. |
|
java.awt.geom.Point2D |
getWorldMousePoint()
Gets the world coordinates of the last mouse event |
|
void |
hideMouseBox()
Hides the mouse box |
|
boolean |
isDrawingInImageSpace()
Returns true if this is drawing in image space rather than world space. |
|
boolean |
isPlayerVisible()
Gets the video player visibility. |
|
boolean |
isShowCoordinates()
Returns true if mouse coordinates are displayed |
|
protected void |
paintEverything(java.awt.Graphics g)
Overrides DrawingPanel paintEverything method. |
|
void |
propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. |
|
void |
removeDrawable(Drawable drawable)
Removes a drawable object from the drawable list. |
|
void |
removeFilter(java.lang.Class<?> filterClass)
Removes a video filter class from the map of available filters. |
|
|
removeObjectsOfClass(java.lang.Class<T> c)
Removes all objects of the specified class. |
|
protected void |
scale(java.util.ArrayList<Drawable> drawables)
Overrides DrawingPanel scale method to handle drawing in imagespace |
|
void |
setCoords(ImageCoordSystem newCoords)
Sets the image coordinate system used to convert between image and world spaces. |
|
void |
setDataFile(java.io.File file)
Sets the file in which data is saved. |
|
void |
setDrawingInImageSpace(boolean imagespace)
Sets the drawing space to imagespace or worldspace. |
|
void |
setImageBorder(double borderFraction)
Sets the image border. |
|
void |
setImageHeight(double h)
Sets the image height in image units (1.0 unit/pixel). |
|
void |
setImageWidth(double w)
Sets the image width in image units. |
|
void |
setPlayerVisible(boolean visible)
Shows or hides the video player. |
|
void |
setVideo(Video newVideo)
Sets the video. |
Methods inherited from class org.opensourcephysics.display.InteractivePanel |
---|
getCurrentDraggable, getInteractive, getMouseAction, getMouseButton, getMouseClickCount, getMouseIntX, getMouseIntY, getMouseX, getMouseY, handleMouseAction, saveMouseEvent, scaleX, scaleY, setInteractiveMouseHandler, setShowCoordinates |
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, getGraphics, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, 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, 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, hasFocus, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setLocale, setLocation, setLocation, setName, setSize, 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 |
---|
protected static int defaultWidth
protected static int defaultHeight
public boolean changed
public java.lang.String defaultFileName
protected VideoPlayer player
protected TextPanel mousePanel
protected TextPanel messagePanel
protected Video video
protected boolean playerVisible
protected boolean drawingInImageSpace
protected double imageWidth
protected double imageHeight
protected double xOffset
protected double yOffset
protected double imageBorder
protected ImageCoordSystem coords
protected java.awt.geom.Point2D pt
protected java.io.File dataFile
protected java.util.Map<java.lang.String,java.lang.Class<? extends Filter>> filterClasses
Constructor Detail |
---|
public VideoPanel()
public VideoPanel(Video video)
video
- the video to be drawnMethod Detail |
---|
public void setVideo(Video newVideo)
newVideo
- the videopublic Video getVideo()
public double getImageWidth()
public void setImageWidth(double w)
w
- the widthpublic double getImageHeight()
public void setImageHeight(double h)
h
- the heightpublic double getImageBorder()
public void setImageBorder(double borderFraction)
borderFraction
- the border fractionpublic void setCoords(ImageCoordSystem newCoords)
newCoords
- the image coordinate systempublic ImageCoordSystem getCoords()
public void setDataFile(java.io.File file)
file
- the data filepublic java.io.File getDataFile()
public java.lang.String getFilePath()
public void setDrawingInImageSpace(boolean imagespace)
imagespace
- true
to draw in imagespacepublic boolean isDrawingInImageSpace()
true
if drawing in image spacepublic VideoPlayer getPlayer()
public void setPlayerVisible(boolean visible)
visible
- true
to show the playerpublic boolean isPlayerVisible()
true
if the player is visiblepublic int getStepNumber()
public int getFrameNumber()
public java.util.ArrayList<Drawable> getDrawables()
getDrawables
in class DrawingPanel
public void addDrawable(Drawable drawable)
addDrawable
in class InteractivePanel
drawable
- the drawable objectpublic void removeDrawable(Drawable drawable)
removeDrawable
in class DrawingPanel
drawable
- the drawable objectpublic <T extends Drawable> void removeObjectsOfClass(java.lang.Class<T> c)
removeObjectsOfClass
in class DrawingPanel
c
- the class to removeDrawingPanel.removeDrawables(Class c)
public void clear()
clear
in class InteractivePanel
public void addFilter(java.lang.Class<? extends Filter> filterClass)
filterClass
- the filter class to addpublic void removeFilter(java.lang.Class<?> filterClass)
filterClass
- the filter class to removepublic java.util.Map<java.lang.String,java.lang.Class<? extends Filter>> getFilters()
public boolean isShowCoordinates()
true
if mouse coordinates are displayedpublic void hideMouseBox()
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- the property change eventprotected void paintEverything(java.awt.Graphics g)
paintEverything
in class DrawingPanel
g
- the graphics context to draw onprotected void scale(java.util.ArrayList<Drawable> drawables)
scale
in class DrawingPanel
drawables
- the list of drawable objectsprotected boolean checkImage()
true
if the image is correctly sizedpublic java.awt.geom.Point2D getWorldMousePoint()
public static XML.ObjectLoader getLoader()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |