org.geotoolkit.gui.swing.image
Class ImagePane
Object
Component
Container
JComponent
ZoomPane
ImagePane
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, DeformableViewer
public class ImagePane
- extends ZoomPane
A simple image viewer. This widget accepts either rendered or
renderable image. Rendered image are displayed immediately,
while renderable image will be rendered in a background thread when first requested.
This widget may scale down images for faster rendering. This is convenient for image
previews, but should not be used as a "real" (i.e. robust and accurate) renderer.
- Since:
- 2.3
- Version:
- 3.07
- Author:
- Martin Desruisseaux (IRD, Geomatys)
- See Also:
ImageProperties,
Serialized Form
- Module:
|
Constructor Summary |
ImagePane()
Constructs an initially empty image pane with a default rendered image size. |
ImagePane(Dimension renderedSize)
Constructs an initially empty image pane with the specified rendered image size. |
ImagePane(int renderedSize)
Constructs an initially empty image pane with the specified rendered image size. |
| Methods inherited from class ZoomPane |
addMouseListener, addZoomChangeListener, buildNavigationMenu, correctApparentPixelPosition, createScrollPane, fireZoomChanged, getDefaultSize, getInsets, getMagnifierBorder, getMagnifierGlass, getMagnifierMenu, getMouseSelectionShape, getPopupMenu, getPreferredArea, getPreferredPixelSize, getScaleFactor, getTransform, getVisibleArea, getZoomableBounds, hasPreferredArea, isMagnifierEnabled, isMagnifierVisible, isPaintingWhileAdjusting, mouseSelectionPerformed, paintComponent, paintMagnifier, printComponent, printComponent, removeZoomChangeListener, repaint, reset, scrollRectToVisible, setMagnifierBorder, setMagnifierEnabled, setMagnifierGlass, setMagnifierVisible, setPaintingWhileAdjusting, setPreferredArea, setResetPolicy, setTransform, setVisibleArea, tieModels, transform, transformPixels, untieModels, updateUI |
| Methods inherited from class JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, 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 |
| Methods inherited from class 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 Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
ImagePane
public ImagePane()
- Constructs an initially empty image pane with a default rendered image size.
ImagePane
public ImagePane(int renderedSize)
- Constructs an initially empty image pane with the specified rendered image size.
The
renderedSize argument is the maximum width and height for
rendered image. Images greater than this value will be
scaled down for faster rendering.
- Parameters:
renderedSize - The maximal image width and height.
ImagePane
public ImagePane(Dimension renderedSize)
- Constructs an initially empty image pane with the specified rendered image size.
The
renderedSize argument is the maximum dimension for
rendered image. Images greater than this value will be
scaled down for faster rendering.
- Parameters:
renderedSize - The maximal image dimension before to scale down.- Since:
- 3.07
setImage
public void setImage(RenderableImage image)
- Sets the source renderable image. The given image will be
rendered
in a background thread when first needed.
- Parameters:
image - The image to display, or null if none.
setImage
public void setImage(RenderedImage image)
- Sets the source rendered image. If the given image is larger than the size
given at construction time, then it will be scaled down when first needed.
A
null value remove the current image.
- Parameters:
image - The image to display, or null if none.
setError
public void setError(Throwable error)
- Removes the current image (if any) and paints the stack trace of the given exception
instead. This method is invoked when the client code failed to create the image to
display, typically because of an
IOException.
The error is cleaned when a setImage(...) method is invoked.
- Parameters:
error - The error to paint, or null if none.- Since:
- 3.05
setProgressVisible
public void setProgressVisible(boolean visible)
- Shows or hide the progress bar. This method should be invoked with the value
true
before to invoke setProgress(int), and invoked again with the value false
when the operation is completed. This will not be done automatically.
- Parameters:
visible - true for showing the progress pane, or false for hiding it.- Since:
- 3.07
isProgressVisible
public boolean isProgressVisible()
- Returns
true if the progress bar is visible, or false otherwise.
This method returns the last value given to the setProgressVisible(boolean)
method, or false if the value has never been set.
- Returns:
true if the progress bar is currently visible.- Since:
- 3.07
setProgressLabel
public void setProgressLabel(String label)
- Sets the label to display on top of the progress bar. If this method has never been
invoked, then the default value is
"Loading..." localized for the current locale.
- Parameters:
label - The new label to print on top of the progress bar.- Since:
- 3.07
getProgressLabel
public String getProgressLabel()
- Returns the current label to display on top of the progress bar. This is the last value
given to the
setProgressLabel(String) method, or "Loading..." localized
for the current locale if the value has never been set.
- Returns:
- The current label to print on top of the progress bar.
- Since:
- 3.07
setProgress
public void setProgress(int percentageDone)
- Sets the progress done, as a percentage between 0 and 100 inclusive. This method can
be invoked during lengthly operation like reading the image from a file. The lengthly
operation is typically run in a background thread, but this method shall be invoked
from the Swing thread only.
The setProgressVisible(boolean) method should be invoked before to lengthly
operation begin, and when it is finished.
- Parameters:
percentageDone - The percentage done as a number between 0 and 100 inclusive.- Since:
- 3.07
getProgress
public int getProgress()
- Returns the current progress, as a percentage between 0 and 100 inclusive. This is the last
value given to the
setProgress(int) method, or 0 if the value has never been set.
- Returns:
- The current progress percentage.
- Since:
- 3.07
reset
public void reset()
- Resets the default zoom. This method overrides the default implementation in
order to keep the y axis in its Java2D direction (y
value increasing down), which is the usual direction of most image.
- Overrides:
reset in class ZoomPane
getArea
public Rectangle2D getArea()
- Returns the image bounds, or
null if none. This is used by
ZoomPane in order to set the initial zoom.
- Specified by:
getArea in class ZoomPane
- Returns:
- A bounding box for the logical coordinates of all contents that are going to be
drawn in this
ZoomPane. If this bounding box is unknown, then this method
can return null (but this is not recommended).
paintComponent
protected void paintComponent(Graphics2D graphics)
- Paints the image. If the image was a
RenderableImage, then a RenderedImage
will be computed in a background thread when this method is first invoked. If the rendering
fails, then the exception stack trace will be painted.
- Specified by:
paintComponent in class ZoomPane
- Parameters:
graphics - The graphics where to paint this component.
Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.