public class ImagePreview extends FilePreview implements java.beans.PropertyChangeListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AVERAGESCALE |
static int |
DEFAULTHEIGHT |
static java.lang.String |
DEFAULTSCALE |
static int |
DEFAULTWIDTH |
protected boolean |
disabledThumbnail |
protected boolean |
enabled |
static java.lang.String |
FASTSCALE |
protected java.io.File |
file |
protected boolean |
forcergb |
protected int |
imageHeight |
protected int |
imageWidth |
static int |
LEFTBORDER |
protected long |
maxsize |
protected int |
previewHeight |
protected java.lang.String |
previewScale |
protected int |
previewWidth |
static int |
SAFEBORDER |
protected int |
scaleLevel |
static java.lang.String |
SMOOTHSCALE |
static java.lang.String |
SUBSAMPLESCALE |
protected javax.swing.ImageIcon |
thumbnail |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ImagePreview()
Dummy constructor.
|
ImagePreview(javax.swing.JFileChooser fc,
Conf conf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Get image file.
|
int |
getImageHeight() |
int |
getImageWidth() |
java.lang.String |
getPreviewScale()
Get preview scale quality.
|
boolean |
getPreviewState() |
protected double |
getScale(int w,
int h,
int maxw,
int maxh)
Compute scale from max width and max height and keep aspect ratio.
|
protected javax.swing.ImageIcon |
getThumbnail(java.io.File f,
int w,
int h,
int level)
Scale input image.
|
boolean |
isDisabledThumbnail() |
void |
loadImage()
Load image and resize it if needed.
|
protected void |
paintComponent(java.awt.Graphics g) |
void |
propertyChange(java.beans.PropertyChangeEvent e) |
void |
setDisabledThumbnail(boolean disabledThumbnail) |
void |
setFile(java.io.File file)
Set image file.
|
void |
setForceRGB(boolean b) |
void |
setPreviewScale(java.lang.String scale)
Set preview scale quality.
|
void |
setPreviewState(boolean enable) |
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, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
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, 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
public static final java.lang.String SUBSAMPLESCALE
public static final java.lang.String FASTSCALE
public static final java.lang.String DEFAULTSCALE
public static final java.lang.String AVERAGESCALE
public static final java.lang.String SMOOTHSCALE
public static int DEFAULTWIDTH
public static int DEFAULTHEIGHT
public static int SAFEBORDER
public static int LEFTBORDER
protected javax.swing.ImageIcon thumbnail
protected java.io.File file
protected java.lang.String previewScale
protected int scaleLevel
protected int previewWidth
protected int previewHeight
protected boolean enabled
protected long maxsize
protected int imageWidth
protected int imageHeight
protected boolean forcergb
protected boolean disabledThumbnail
public ImagePreview()
public ImagePreview(javax.swing.JFileChooser fc, Conf conf)
fc
- JFileChooserconf
- Confpublic int getImageHeight()
public int getImageWidth()
public void setPreviewState(boolean enable)
setPreviewState
in class FilePreview
public boolean getPreviewState()
getPreviewState
in class FilePreview
public void setPreviewScale(java.lang.String scale)
scale
- Stringpublic void setForceRGB(boolean b)
public boolean isDisabledThumbnail()
public void setDisabledThumbnail(boolean disabledThumbnail)
public java.lang.String getPreviewScale()
public void loadImage()
protected javax.swing.ImageIcon getThumbnail(java.io.File f, int w, int h, int level)
f
- Filew
- inth
- intlevel
- intpublic void setFile(java.io.File file)
file
- public java.io.File getFile()
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
protected double getScale(int w, int h, int maxw, int maxh)
w
- image widthh
- image heightmaxw
- max widthmaxh
- max heightprotected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent