All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class GraphicPlotter.MagnifyingScrollbar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Scrollbar
                   |
                   +----GraphicPlotter.MagnifyingScrollbar

public final class MagnifyingScrollbar
extends Scrollbar
implements Magnifier
MagnifyingScrollbar controls the magnifying and scrolling of several components that are to be magnified and scrolled together. Each of the controlled components are wrapped in a MagnifyingPane.

The scrolling units are in terms of AWT coordinates. That is,

Because the scrolling units are in terms of AWT coordinates, the AWT sizes of a MagnifyingScrollbar and the MagnifyingPanes it controls should be the same. That is, for a HORIZONTAL scrollbar, the AWT width of the scrollbar and all the MagnifyingPanes controlled by the scrollbar should be the same; for a VERTICAL scrollbar, the AWT height of the scrollbar and all the MagnifyingPanes controlled by the scrollbar should be the same. These constraints should be imposed by using appropriate layout manager constraints on the scrollbar and the MagnifyingPanes it controls.

See Also:
MagnifyingPane

Variable Index

 o magBase
The base magnification value (percent).

Constructor Index

 o MagnifyingScrollbar(int)
Construct a MagnifyingScrollbar with a default maximum coordinate value (of Short.MAX_VALUE).
 o MagnifyingScrollbar(int, int)
Construct a MagnifyingScrollbar with the given maximum coordinate value.

Method Index

 o add(MagnifyingPane)
Add a MagnifyingPane to be controlled by this scrollbar.
 o finalize()
Override finalize() for implementation reasons.
 o getMagnification()
Return the current magnification.
 o getMagnificationMax()
Return the maximum magnification.
 o getMagnificationMin()
Return the minimum magnification.
 o getPosition()
Return the current position of the scrollbar.
 o remove(MagnifyingPane)
Remove a MagnifyingPane from being controlled by this scrollbar.
 o removeAll()
Remove all components from being controlled by this scrollbar.
 o repaintAdjusted()
Repaint all the components controlled by this that need to be repainted.
 o resetMagnificationCenter()
Reset centering point of magnifaction to default setting.
 o scrollToValue()
Scroll the objects controlled by the MagnifyingScrollbar to the current scrollbar value.
 o setBounds(int, int, int, int)
Override setBounds() for implementation reasons.
 o setMagnification(int)
Set the magnification of all components controlled by this magnifier.
 o setMagnificationCenter(double)
Set centering point of magnifaction as fraction of viewport size.
 o setPosition(int)
Set the position of the scrollbar.
 o validateAll()
Validate all the components controlled by this magnifier.

Variables

 o magBase
 public static final int magBase
The base magnification value (percent).

Constructors

 o MagnifyingScrollbar
 public MagnifyingScrollbar(int orientation,
                            int coordinateMax)
Construct a MagnifyingScrollbar with the given maximum coordinate value.

Parameters:
orientation - the orientation of the scrollbar (either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL)
coordinateMax - the maximum coordinate value

The maximum coordinate value determines the maximum zoom percentage. Basically, the maximum zoom percentage is the maximum coordinate value divided by the screen size.

From the point of view of the Java AWT, the maximum coordinate value is Integer.MAX_VALUE (Java AWT coordinates are stored in fields of type int). However, some concrete windowing toolkits use coordinates of type short.

When this class was written, (at least for some implementations of the Java AWT) it appeared that coordinate values were being mapped from AWT int values to concrete windowing toolkit short values by trucation. Truncation produces incorrect results. For example, an AWT coordinate value of 32768 (0x8000) is mapped a concrete windowing toolkit coordinate value of -32767.

If a program wants to use a maximum coordinate value greater than Short.MAX_VALUE it needs to either

  1. run using a Java AWT implementation that clips rather than truncates AWT coordinates to map them to concrete windowing toolkit coordinates, or
  2. implement its own clipping of components controlled by a MagnifyingScrollbar
 o MagnifyingScrollbar
 public MagnifyingScrollbar(int orientation)
Construct a MagnifyingScrollbar with a default maximum coordinate value (of Short.MAX_VALUE).

Parameters:
orientation - the orientation of the scrollbar (either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL)

Methods

 o finalize
 public void finalize() throws Throwable
Override finalize() for implementation reasons.

Throws: Throwable
when Object.finalize() does
Overrides:
finalize in class Object
 o add
 public void add(MagnifyingPane pane)
Add a MagnifyingPane to be controlled by this scrollbar.

 o remove
 public void remove(MagnifyingPane pane)
Remove a MagnifyingPane from being controlled by this scrollbar.

 o removeAll
 public void removeAll()
Remove all components from being controlled by this scrollbar.

 o setBounds
 public void setBounds(int x,
                       int y,
                       int width,
                       int height)
Override setBounds() for implementation reasons.

Overrides:
setBounds in class Component
 o getMagnificationMin
 public final int getMagnificationMin()
Return the minimum magnification.

 o getMagnificationMax
 public final int getMagnificationMax()
Return the maximum magnification.

 o getMagnification
 public final int getMagnification()
Return the current magnification.

 o setMagnification
 public void setMagnification(int mag)
Set the magnification of all components controlled by this magnifier.

 o validateAll
 public void validateAll()
Validate all the components controlled by this magnifier.

 o getPosition
 public int getPosition()
Return the current position of the scrollbar. For a vertical scrollbar, the position is that of the bottom of the scrollbar.

For a vertical scrollbar, a value of Integer.MAX_VALUE is returned when the scrollbar is at the bottom of its range and the position cooresponding to the bottom of the range could not be determined. (This may occur when the scrollbar is invisible).

 o setPosition
 public void setPosition(int position)
Set the position of the scrollbar.

 o repaintAdjusted
 public void repaintAdjusted()
Repaint all the components controlled by this that need to be repainted.

 o scrollToValue
 public void scrollToValue()
Scroll the objects controlled by the MagnifyingScrollbar to the current scrollbar value.

 o setMagnificationCenter
 public void setMagnificationCenter(double cf)
Set centering point of magnifaction as fraction of viewport size. For horziontal scrollbar 0.0 = left edge, 1.0 = right edge. For vertical scrollbar 0.0 = top edge, 1.0 = bottom edge.

 o resetMagnificationCenter
 public void resetMagnificationCenter()
Reset centering point of magnifaction to default setting.


All Packages  Class Hierarchy  This Package  Previous  Next  Index