org.geotools.gui.swing
Class ImagePane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byorg.geotools.gui.swing.ZoomPane
                  extended byorg.geotools.gui.swing.ImagePane
All Implemented Interfaces:
DeformableViewer, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class ImagePane
extends ZoomPane
implements java.lang.Runnable

A simple image viewer. This widget accepts either rendered or renderable image. Rendered image are display 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" renderer for full precision images.

Since:
2.2
Version:
$Id: ImagePane.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.geotools.gui.swing.ZoomPane
DEFAULT_ZOOM, RESET, ROTATE, SCALE_X, SCALE_Y, TRANSLATE_X, TRANSLATE_Y, UNIFORM_SCALE, zoom
 
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
ImagePane()
          Constructs an initially empty image pane with a default rendered image size.
ImagePane(int renderedSize)
          Constructs an initially empty image pane with the specified rendered image size.
 
Method Summary
 java.awt.geom.Rectangle2D getArea()
          Returns the image bounds, or if none.
protected  void paintComponent(java.awt.Graphics2D graphics)
          Paint the image.
 void reset()
          Reset the default zoom.
 void run()
          Creates a rendered view of the renderable image and notifies ZoomPane when the result is ready.
 void setImage(java.awt.image.renderable.RenderableImage image)
          Sets the source renderable image.
 void setImage(java.awt.image.RenderedImage image)
          Sets the source rendered image.
 
Methods inherited from class org.geotools.gui.swing.ZoomPane
addMouseListener, addZoomChangeListener, buildNavigationMenu, correctApparentPixelPosition, createScrollPane, fireZoomChanged, getDefaultSize, getInsets, getInsets, getMagnifierBorder, getMagnifierGlass, getMagnifierMenu, getMouseSelectionShape, getPopupMenu, getPreferredArea, getPreferredPixelSize, getScaleFactor, getVisibleArea, getZoomableBounds, hasPreferredArea, isMagnifierEnabled, isMagnifierVisible, isPaintingWhileAdjusting, mouseSelectionPerformed, paintComponent, paintMagnifier, printComponent, printComponent, removeZoomChangeListener, repaint, reset, scrollRectToVisible, setMagnifierBorder, setMagnifierEnabled, setMagnifierGlass, setMagnifierVisible, setPaintingWhileAdjusting, setPreferredArea, setResetPolicy, setVisibleArea, tieModels, transform, transformPixels, untieModels, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 argument is the maximum width and height for rendered image. Images greater than this value will be scaled down for faster rendering.

Method Detail

setImage

public void setImage(java.awt.image.renderable.RenderableImage image)
Sets the source renderable image.


setImage

public void setImage(java.awt.image.RenderedImage image)
Sets the source rendered image.


reset

public void reset()
Reset 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 java.awt.geom.Rectangle2D getArea()
Returns the image bounds, or 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 . If this bounding box is unknown, then this method can return (but this is not recommended).

paintComponent

protected void paintComponent(java.awt.Graphics2D graphics)
Paint the image. If the image was a RenderableImage, then a RenderedImage will be computed in a background thread when this method is first invoked.

Specified by:
paintComponent in class ZoomPane

run

public void run()
Creates a rendered view of the renderable image and notifies ZoomPane when the result is ready. This method is run in a background thread and should not be invoked directly, unless the user wants to trig the RenderedImage creation immediately.

Specified by:
run in interface java.lang.Runnable


Copyright © GeoTools. All Rights Reserved.