The zoom factor by default is 1. It can be changed with the 'zoom()' and 'setZoom()' methods. The maximum zoom factor is defined by MAX_ZOOM.
The zoom scaling is done directly by the AWT display system. In general it is performed by dropping or repeating lines. It is just intended to provide a display zoom and not for proper scaling of an image.
The scrolling can be performed by copying the actual displayed data to the new scrolled position and redrawing the damaged parts, or by redrawing the entire displayed image portion at the new scrolled position. Which is more efficient depends on the JVM and working environment. By default it is done by copying since it tends to provide less annoying visual artifacts while scrolling, but that can be changed with 'setCopyScroll()'.
This class is very similar to the AWT ScrollPane one, but it is optimized for display of large images and does not suffer from the problems of ScrollPane when changing zoom. The Adjustable elements that represent the scrollbars are made available as in ScrollPane, but the minimum, maximum, visible amount and block increment should not be set (IllegalArgumentException is thrown if attempted), since they are set internally by this class.
Focus and key event listeners that are registered are in fact registered with the components that implement the three areas (the image display and the two scrollbars) so that if any such event is fired in any of these areas it is handled by the registered listener.
Mouse and mouse movement event listeners that are registered are in fact registered with the image display component only. The mouse and mouse movement events on the scrollbars are handled by the Scrollbar default listeners only.
Although it is implemented as a container, it behaves like a component. Specifically no components can be added or removed from objects of this class. Furthermore, no layout manager can be set. It is internally set and it can not be changed.
The implementation uses a lightweight container with an inner class to display the image itself, and two scrollbars. The layout manager is a BorderLayout.
This class should be really implemented as a Component, but it is implemented as a Container for easyness. It should not be assumed it is a subclass of Container since in the future it might be rewritten as a subclass of Component only. @see ScrollPane @see Adjustable
|
|
|
|
|
|