public class PicturePanel
extends javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected double |
zoomLevel
Current zoom level for this picture panel, represented as
a percentage of the picture size
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
PicturePanel(PhotoPanel f,
Photo photo)
Create a new PicturePanel to integrate into the window.
|
Modifier and Type | Method and Description |
---|---|
void |
centerPic()
This method centers the picture into the current panel, according
to the panel dimension.
|
void |
crop()
Crop the picture according to the current selection
|
void |
fitToScreen()
Fit the picture to the current display area.
|
void |
fitWidth()
Fit the picture so its width fits the display's width.
|
java.awt.Point[] |
getCurrentSel()
Get the current selection
|
java.lang.String |
getTagPersonName(int x,
int y)
Get the person tagged at the given coordinates.
|
void |
move(int dx,
int dy)
Moves the picture on the panel.
|
void |
paintComponent(java.awt.Graphics g)
Overrided method taking care of drawing the picture into the panel,
according to the current position and zoom level.
|
void |
removeTagPerson(java.lang.String name)
Remove the tag with the given name.
|
void |
selectPerson(int x,
int y,
int dx,
int dy)
This method selects the person tag under the given coordinates.
|
void |
tagPerson(java.lang.String name)
Transform the current selection into a person tag, with the given name
|
void |
undoSelectPerson()
Unselect the current selected person tag, if any.
|
protected void |
updateImage(java.awt.Image i)
Update the displayed image with the given one, and reset display
parameters.
|
void |
zoom(int dZoom)
Increment the zoom with the given value
|
void |
zoom(int dZoom,
int zoomX,
int zoomY)
Increment the zoom of dZoom increments, focusing the zoom on the given point
coordinates.
|
void |
zoomOriginal()
Adapt the zoom to display the picture in its original size.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, 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, isPaintingOrigin, isPaintingTile,
isRequestFocusEnabled, isValidateRoot, paint, 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, setVisible,
unregisterKeyboardAction, update
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, transferFocusDownCycle, validate, validateTree
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,
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, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable,
setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName,
setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward,
transferFocusUpCycle
protected double zoomLevel
public PicturePanel(PhotoPanel f, Photo photo)
f
- parent PhotoPanelphoto
- Photo object to dislaypublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void centerPic()
public void move(int dx, int dy)
move
in class java.awt.Component
dx
- Move the picture of dx pixels to the rightdy
- Move the picture of dy pixels to the bottompublic void selectPerson(int x, int y, int dx, int dy)
x
- previous horizontal position of the mousey
- previous vertical position of the mousedx
- current horizontal position of the mousedy
- current horizontal position of the mousepublic void undoSelectPerson()
public java.awt.Point[] getCurrentSel()
public void tagPerson(java.lang.String name)
name
- Name of the person being taggedpublic void crop()
public java.lang.String getTagPersonName(int x, int y)
x
- x coordinatey
- y coordinatepublic void removeTagPerson(java.lang.String name)
name
- Name of the person whose tag should be removed.public void fitToScreen()
public void fitWidth()
public void zoomOriginal()
public void zoom(int dZoom)
dZoom
- Value to add to the zoompublic void zoom(int dZoom, int zoomX, int zoomY)
dZoom
- zoom increments to apply on the current zoomzoomX
- X coordinate to zoom on/fromzoomY
- Y coordinate to zoom on/fromprotected void updateImage(java.awt.Image i)
i
- new Image to display instead of the current picture.