public class ThumbnailDisplay
extends javax.swing.JPanel
Usage example:
constructor
setThumbnail
movePanner
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private java.awt.image.BufferedImage |
bufferedImage
Is the thumbnail image.
|
private int |
dx1
The x coordinate of the first corner of the destination rectangle.
|
private int |
dx2
The x coordinate of the second corner of the destination rectangle.
|
private int |
dy1
The y coordinate of the first corner of the destination rectangle.
|
private int |
dy2
The y coordinate of the second corner of the destination rectangle.
|
private int |
height
Height of the panel
|
private java.awt.Insets |
insets
Insets of the panel.
|
private java.awt.Rectangle |
panner
Are the panner coordinates (origin and size).
|
private java.awt.Color |
pannerColor
Is the color that will be used to display the panner.
|
private javax.swing.JFrame |
parent
Reference to the parent window.
|
private boolean |
setThumnailImage
Indicates whether the thumbnail image is available or not.
|
private int |
sx1
The x coordinate of the first corner of the source rectangle.
|
private int |
sx2
The x coordinate of the second corner of the source rectangle.
|
private int |
sy1
The y coordinate of the first corner of the source rectangle.
|
private int |
sy2
The y coordinate of the second corner of the source rectangle.
|
private int |
width
Width of the panel
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ThumbnailDisplay(javax.swing.JFrame parent,
int width,
int height)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the thumbnail display.
|
private void |
createAndShowGUI()
Display the DrawingPanel with BufferedImage on the applet.
|
private java.awt.image.BufferedImage |
createView(java.awt.image.BufferedImage bImage)
Creates a new view of the raster image that fits to the thumbnail
display window.
|
private void |
displayImage()
Build a BufferedImage from a pixel array.
|
java.awt.Dimension |
getDisplaySize()
Returns the size of the area where thumbnail is displayed.
|
java.awt.Dimension |
getImageSize()
Returns the image size.
|
java.awt.Dimension |
getSize() |
protected void |
movePanner(int imgWidth,
int imgHeight,
int x,
int y,
int width,
int height)
Moves the panner window on the thumbnail image to the new position and
size.
|
void |
paintComponent(java.awt.Graphics g) |
void |
setThumbnail(java.awt.image.BufferedImage bufferedImage)
Sets a new thumbnail to be displayed.
|
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, 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, transferFocusBackward, transferFocusUpCycle
private javax.swing.JFrame parent
private int width
private int height
private java.awt.image.BufferedImage bufferedImage
private java.awt.Rectangle panner
private final java.awt.Color pannerColor
panner
private java.awt.Insets insets
private int dx1
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int dy1
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int dx2
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int dy2
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int sx1
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int sy1
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int sx2
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private int sy2
Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
private boolean setThumnailImage
setThumbnail(BufferedImage)
method
has been called.public ThumbnailDisplay(javax.swing.JFrame parent, int width, int height)
parent
- reference to the parent window.width
- width of the panelheight
- height of the panelpublic void setThumbnail(java.awt.image.BufferedImage bufferedImage)
bufferedImage
- the new thumbnail image.public void clear()
protected void movePanner(int imgWidth, int imgHeight, int x, int y, int width, int height)
The coordinates which are passed in this method are referred to the original image. The dimensions of the original image are also passed to the method.
imgWidth
- width of the original imageimgHeight
- height of the original imagex
- x coordinate in the original imagey
- y corrdinate in the original imagewidth
- width in the original imageheight
- height in the original imagepublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public java.awt.Dimension getSize()
getSize
in class java.awt.Component
public java.awt.Dimension getDisplaySize()
public java.awt.Dimension getImageSize()
private void createAndShowGUI()
private void displayImage()
private java.awt.image.BufferedImage createView(java.awt.image.BufferedImage bImage)
bImage
- image to be scaled.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)