|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--jj2000.disp.ImgScrollPane.ImageScrollDisplay
This class implements the component that displays the currently viewable image portion inside the ImgScrollPane. It handles the necessary erasing, zooming and panning.
NOTE: extending 'Canvas' instead of 'Component' solves the flickering problem of lightweight components which are in heavyweight containers.
Nested Class Summary |
Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
(package private) java.awt.Dimension |
dim
The preferred size for this component |
(package private) int |
dimFlags
The image dimension flags, as in ImageObserver. |
(package private) boolean |
erase
If the current graphics context should be erased prior to drawing the image. |
(package private) java.awt.Image |
img
The image to be displayed |
(package private) java.awt.Dimension |
imgDim
The image dimensions, without any scaling. |
(package private) java.awt.Point |
lastUpdateOffset
The last offset used in update(). |
Fields inherited from class java.awt.Canvas |
|
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 | |
private |
ImgScrollPane.ImageScrollDisplay()
|
Method Summary | |
(package private) boolean |
calcDim()
Calculates the image display dimensions according to the zoom and image size. |
java.awt.Dimension |
getMaximumSize()
Returns the maximum size for this component, which is infinite. |
java.awt.Dimension |
getMinimumSize()
Returns the minimum size for this component, which is (0,0). |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size for this component, which is the image display size, if known, the previous image display size, if any, or the size specified at the constructor. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int w,
int h)
Monitors the image rendering for dimensions and calls the superclass' 'imageUpdate()' method. |
void |
paint(java.awt.Graphics g)
Paints the image, if any, on the graphics context by calling update(). |
(package private) void |
setImage(java.awt.Image img)
Sets the image to display in this component. |
void |
update(java.awt.Graphics g)
Updates the component by drawing the relevant part of the image that fits within the Graphics clipping area of 'g'. |
Methods inherited from class java.awt.Canvas |
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
java.awt.Image img
java.awt.Dimension dim
boolean erase
java.awt.Dimension imgDim
int dimFlags
java.awt.Point lastUpdateOffset
Constructor Detail |
private ImgScrollPane.ImageScrollDisplay()
Method Detail |
void setImage(java.awt.Image img)
If the image is not ready for display (i.e. it has not been rendered at its natural size) it will be rendered in the current thread, if not being already rendered in another one. This means that the current thread can block until the image is ready.
If the image is rendered incrementally (it depends on the underlying 'ImageProducer') it will be displayed in that way if the incremental display is set for the Component class. See the 'imageUpdate()' method of the 'Component' class.
If the image is the same as the current one nothing is done.
img
- The image to display.Component.imageUpdate(java.awt.Image, int, int, int, int, int)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Component
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class java.awt.Component
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int w, int h)
imageUpdate
in interface java.awt.image.ImageObserver
imageUpdate
in class java.awt.Component
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
,
Component.imageUpdate(java.awt.Image, int, int, int, int, int)
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
g
- The graphics context to paint on.public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
g
- The graphics context where to drawsetImage(java.awt.Image)
boolean calcDim()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |