com.github.sarxos.webcam
public class WebcamPanel extends JPanel implements WebcamListener, PropertyChangeListener
Modifier and Type | Class and Description |
---|---|
class |
WebcamPanel.DefaultPainter
Default painter used to draw image in panel.
|
static interface |
WebcamPanel.Painter
Interface of the painter used to draw image in panel.
|
JComponent.AccessibleJComponent
Component.BaselineResizeBehavior
Modifier and Type | Field and Description |
---|---|
static double |
MIN_FREQUENCY
Minimum FPS frequency.
|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
WebcamPanel(Webcam webcam)
Creates webcam panel and automatically start webcam.
|
WebcamPanel(Webcam webcam,
boolean start)
Creates new webcam panel which display image from camera in you your
Swing application.
|
WebcamPanel(Webcam webcam,
Dimension size,
boolean start)
Creates new webcam panel which display image from camera in you your
Swing application.
|
Modifier and Type | Method and Description |
---|---|
WebcamPanel.Painter |
getDefaultPainter() |
double |
getFPSLimit()
Get rendering frequency in FPS (equivalent to Hz).
|
WebcamPanel.Painter |
getPainter()
Get painter used to draw image in webcam panel.
|
boolean |
isFillArea()
Get value of fill area setting.
|
boolean |
isFPSDisplayed() |
boolean |
isFPSLimited()
Is frequency limit enabled?
|
boolean |
isStarted()
Is webcam panel repainting started.
|
boolean |
isStarting()
Is webcam panel repainting starting.
|
void |
pause()
Pause rendering.
|
void |
propertyChange(PropertyChangeEvent evt) |
void |
resume()
Resume rendering.
|
void |
setFillArea(boolean fillArea)
Image will be resized to fill panel area if true.
|
void |
setFPSDisplayed(boolean displayed) |
void |
setFPSLimit(double fps)
Set rendering frequency (in Hz or FPS).
|
void |
setFPSLimited(boolean frequencyLimit)
Enable or disable frequency limit.
|
void |
setPainter(WebcamPanel.Painter painter)
Set new painter.
|
void |
start()
Open webcam and start rendering.
|
void |
stop()
Stop rendering and close webcam.
|
void |
webcamClosed(WebcamEvent we)
Webcam has been closed
|
void |
webcamDisposed(WebcamEvent we)
Webcam has been disposed
|
void |
webcamImageObtained(WebcamEvent we)
Webcam image has been obtained.
|
void |
webcamOpen(WebcamEvent we)
Webcam has been open.
|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, 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, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final double MIN_FREQUENCY
public WebcamPanel(Webcam webcam)
webcam
- the webcam to be used to fetch imagespublic WebcamPanel(Webcam webcam, boolean start)
webcam
- the webcam to be used to fetch imagesstart
- true if webcam shall be automatically startedpublic WebcamPanel(Webcam webcam, Dimension size, boolean start)
setFillArea(boolean)
method to configure this.webcam
- the webcam to be used to fetch imagessize
- the size of panelstart
- true if webcam shall be automatically startedsetFillArea(boolean)
public void setPainter(WebcamPanel.Painter painter)
painter
- the painter object to be setpublic WebcamPanel.Painter getPainter()
public void start()
public void stop()
public void pause()
public void resume()
public boolean isFPSLimited()
public void setFPSLimited(boolean frequencyLimit)
frequencyLimit
- public double getFPSLimit()
public void setFPSLimit(double fps)
fps
- the frequencypublic boolean isFPSDisplayed()
public void setFPSDisplayed(boolean displayed)
public boolean isStarting()
public boolean isStarted()
public void setFillArea(boolean fillArea)
fillArea
- shall image be resided to fill panel areapublic boolean isFillArea()
public WebcamPanel.Painter getDefaultPainter()
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public void webcamOpen(WebcamEvent we)
WebcamListener
webcamOpen
in interface WebcamListener
we
- a webcam eventpublic void webcamClosed(WebcamEvent we)
WebcamListener
webcamClosed
in interface WebcamListener
we
- a webcam eventpublic void webcamDisposed(WebcamEvent we)
WebcamListener
webcamDisposed
in interface WebcamListener
we
- a webcam eventpublic void webcamImageObtained(WebcamEvent we)
WebcamListener
webcamImageObtained
in interface WebcamListener
we
- a webcam eventCopyright © 2012-2013 Bartosz Firyn (SarXos). All Rights Reserved.