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 class |
WebcamPanel.DrawMode
This enum is to control of how image will be drawn in the panel bounds.
|
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 Map<RenderingHints.Key,Object> |
DEFAULT_IMAGE_RENDERING_HINTS |
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()
Get default painter used to draw panel.
|
double |
getFPSLimit()
Get rendering frequency in FPS (equivalent to Hz).
|
WebcamPanel.Painter |
getPainter()
Get painter used to draw image in webcam panel.
|
boolean |
isAntialiasingEnabled() |
boolean |
isDisplayDebugInfo()
Is displaying of some debug information enabled.
|
boolean |
isFillArea()
Get value of fill area setting.
|
boolean |
isFitArea() |
boolean |
isFPSDisplayed()
This method return true in case if camera FPS is set to be displayed on panel surface.
|
boolean |
isFPSLimited()
Is frequency limit enabled?
|
boolean |
isImageSizeDisplayed()
This method will return true in case when panel is configured to display image size.
|
boolean |
isMirrored()
This method returns true if image mirroring is 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 |
setAntialiasingEnabled(boolean antialiasing)
Turn on/off antialiasing.
|
void |
setDisplayDebugInfo(boolean displayDebugInfo)
Display some debug information on image surface.
|
void |
setFillArea(boolean fillArea)
Image will be resized to fill panel area if true.
|
void |
setFitArea(boolean fitArea)
This method will change the mode of panel area painting so the image will be resized and will
keep scale factor to fit into drawable panel bounds.
|
void |
setFPSDisplayed(boolean displayed)
This method is to control if camera FPS should be displayed on the webcam panel surface.
|
void |
setFPSLimit(double fps)
Set rendering frequency (in Hz or FPS).
|
void |
setFPSLimited(boolean frequencyLimit)
Enable or disable frequency limit.
|
void |
setImageSizeDisplayed(boolean imageSizeDisplayed)
Configure panel to display camera image size to be displayed.
|
void |
setMirrored(boolean mirrored)
Decide whether or not the image from webcam painted on panel surface will be mirrored.
|
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, hide, 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, 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 static final Map<RenderingHints.Key,Object> DEFAULT_IMAGE_RENDERING_HINTS
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 isDisplayDebugInfo()
public void setDisplayDebugInfo(boolean displayDebugInfo)
displayDebugInfo
- the value to control debug informationpublic boolean isFPSDisplayed()
setFPSDisplayed(boolean)
public void setFPSDisplayed(boolean displayed)
displayed
- the value to control if camera FPS should be displayedpublic boolean isImageSizeDisplayed()
public void setImageSizeDisplayed(boolean imageSizeDisplayed)
imageSizeDisplayed
- public void setAntialiasingEnabled(boolean antialiasing)
antialiasing
- the true to enable, false to disable antialiasingpublic boolean isAntialiasingEnabled()
public boolean isStarting()
public boolean isStarted()
public boolean isFitArea()
public void setFitArea(boolean fitArea)
WebcamPanel.DrawMode.NONE
so image will be drawn as it is.fitArea
- the fit area mode enabled or disabledpublic 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 eventpublic boolean isMirrored()
public void setMirrored(boolean mirrored)
mirrored
- the parameter to control if image should be mirroredCopyright © 2012-2014 Bartosz Firyn (SarXos). All Rights Reserved.