public class ImagePanel extends JComponent
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
ANAMORPH_PIXEL_ASPECT
Pixel aspect policy: Use Anamoprh 16:9 pixel aspect (=16/9*4/5=1.4222).
|
static int |
EXACT_PIXEL_ASPECT
Pixel aspect policy: Preserve the exact pixel aspect.
|
static int |
IGNORE_PIXEL_ASPECT
Pixel aspect policy: Ignore pixel aspect.
|
static int |
ROUNDED_PIXEL_ASPECT
Pixel aspect policy: Preserves only extreme pixel aspects,
where one dimension is a multiple of the other dimension.
|
static int |
SCALE_TO_IMAGE_ASPECT
Image scaling policy: Scale to panel but keep the
image aspect.
|
static int |
SCALE_TO_IMAGE_SIZE
Image scaling policy: Scale as defined by #setAspectRatio
and the image aspect.
|
static int |
SCALE_TO_VIEW_SIZE
Image scaling policy: Scale to panel size.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
ImagePanel() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener who is interested in changes of this object.
|
double |
getAspectRatioX()
Gets the horizontal scale factor that is
used to scale images shown in this image panel.
|
double |
getAspectRatioY()
Gets the vertical scale factor that is
used to scale images shown in this image panel.
|
Image |
getImage()
Gets the image that is displayed in this
image panel.
|
int |
getImageScalePolicy()
Returns the image scale policy.
|
int |
getPixelAspectPolicy()
Returns the pixel aspect policy.
|
double |
getPixelAspectX()
Gets the horizontal pixel aspect of the image according to the
pixel aspect policy that is in affect.
|
double |
getPixelAspectY()
Gets the vertical pixel aspect of the image according to the
pixel aspect policy that is in effect.
|
Dimension |
getPreferredImageSize()
Gets the preferred image size.
|
Dimension |
getPreferredSize()
Gets the preferred size of this image panel.
|
RenderingHints |
getRenderingHints()
Gets the rendering hints.
|
Dimension |
getScaledImageSize()
Gets the scaled and pixel aspect corrected image size.
|
double |
getScaleFactor()
Gets the scale factor.
|
BufferedImage |
getTexture()
Gets the backdrop paint.
|
boolean |
imageUpdate(Image img,
int flags,
int x,
int y,
int w,
int h)
XXX Netscape gets very slow when
painting all SOMEBITS of an image.
|
void |
paintComponent(Graphics gr) |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a previously registered listener.
|
void |
setAspectRatio(double ratioX,
double ratioY)
Sets the aspect ratio.
|
protected void |
setAspectRatio0(double ratioX,
double ratioY) |
void |
setImage(Image image)
Sets the image and displays it in this
image panel.
|
void |
setImageScalePolicy(int policy)
Sets the image scale policy.
|
void |
setMessage(String message) |
void |
setPixelAspectPolicy(int policy)
Sets the pixel aspect policy.
|
void |
setRenderingHints(RenderingHints newValue)
Sets the rendering hints.
|
void |
setScaleFactor(double scaleFactor)
Sets the scale factor.
|
void |
setTexture(BufferedImage newValue)
Sets the texture for the backdrop paint.
|
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, 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, updateUIadd, add, add, add, add, addContainerListener, addImpl, 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, validateTreeaction, 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, 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, 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, transferFocusUpCyclepublic static final int IGNORE_PIXEL_ASPECT
public static final int ROUNDED_PIXEL_ASPECT
public static final int EXACT_PIXEL_ASPECT
public static final int ANAMORPH_PIXEL_ASPECT
public static final int SCALE_TO_IMAGE_SIZE
public static final int SCALE_TO_VIEW_SIZE
public static final int SCALE_TO_IMAGE_ASPECT
public void paintComponent(Graphics gr)
paintComponent in class JComponentpublic void setPixelAspectPolicy(int policy)
policy - PixelAspectPolicy must be one of IGNORE_PIXEL_ASPECT,
ROUNDED_PIXEL_ASPECT, EXACT_PIXEL_ASPECT.IllegalArgumentException - When passing invalid policy.public int getPixelAspectPolicy()
public void setImageScalePolicy(int policy)
public int getImageScalePolicy()
public double getPixelAspectX()
public double getPixelAspectY()
public Dimension getPreferredImageSize()
public Dimension getScaledImageSize()
public void setImage(Image image)
public Image getImage()
public void setTexture(BufferedImage newValue)
public BufferedImage getTexture()
public void setScaleFactor(double scaleFactor)
scaleFactor - The scale factor.public double getScaleFactor()
public void setRenderingHints(RenderingHints newValue)
newValue - The new rendering hints.public RenderingHints getRenderingHints()
public void setAspectRatio(double ratioX,
double ratioY)
ratioX - Horizontal scale factor.ratioY - Vertical scale factor.protected void setAspectRatio0(double ratioX,
double ratioY)
public double getAspectRatioX()
public double getAspectRatioY()
public Dimension getPreferredSize()
getPreferredSize in class JComponentpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in class Containerpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in class Componentpublic void setMessage(String message)
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
imageUpdate in interface ImageObserverimageUpdate in class ComponentCopyright © 2014. All Rights Reserved.