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,
- the minimum value is 0,
- the visible value is the AWT size of the scrollbar,
and
- the maximum value is the AWT size of the scrollbar multiplied
by the magnification.
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
-
magBase
- The base magnification value (percent).
-
MagnifyingScrollbar(int)
- Construct a MagnifyingScrollbar with a default maximum coordinate
value (of Short.MAX_VALUE).
-
MagnifyingScrollbar(int, int)
- Construct a MagnifyingScrollbar with the given maximum
coordinate value.
-
add(MagnifyingPane)
- Add a MagnifyingPane to be controlled by this scrollbar.
-
finalize()
- Override finalize() for implementation reasons.
-
getMagnification()
- Return the current magnification.
-
getMagnificationMax()
- Return the maximum magnification.
-
getMagnificationMin()
- Return the minimum magnification.
-
getPosition()
- Return the current position of the scrollbar.
-
remove(MagnifyingPane)
- Remove a MagnifyingPane from being controlled by this scrollbar.
-
removeAll()
- Remove all components from being controlled by this scrollbar.
-
repaintAdjusted()
- Repaint all the components controlled by this that need to be
repainted.
-
resetMagnificationCenter()
- Reset centering point of magnifaction to default setting.
-
scrollToValue()
- Scroll the objects controlled by the MagnifyingScrollbar to the
current scrollbar value.
-
setBounds(int, int, int, int)
- Override setBounds() for implementation reasons.
-
setMagnification(int)
- Set the magnification of all components controlled by this
magnifier.
-
setMagnificationCenter(double)
- Set centering point of magnifaction as fraction of viewport size.
-
setPosition(int)
- Set the position of the scrollbar.
-
validateAll()
- Validate all the components controlled by this magnifier.
magBase
public static final int magBase
- The base magnification value (percent).
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
- run using a Java AWT implementation that clips rather than
truncates AWT coordinates to map them to concrete windowing
toolkit coordinates, or
- implement its own clipping of components controlled by a
MagnifyingScrollbar
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)
finalize
public void finalize() throws Throwable
- Override finalize() for implementation reasons.
- Throws: Throwable
- when Object.finalize() does
- Overrides:
- finalize in class Object
add
public void add(MagnifyingPane pane)
- Add a MagnifyingPane to be controlled by this scrollbar.
remove
public void remove(MagnifyingPane pane)
- Remove a MagnifyingPane from being controlled by this scrollbar.
removeAll
public void removeAll()
- Remove all components from being controlled by this scrollbar.
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Override setBounds() for implementation reasons.
- Overrides:
- setBounds in class Component
getMagnificationMin
public final int getMagnificationMin()
- Return the minimum magnification.
getMagnificationMax
public final int getMagnificationMax()
- Return the maximum magnification.
getMagnification
public final int getMagnification()
- Return the current magnification.
setMagnification
public void setMagnification(int mag)
- Set the magnification of all components controlled by this
magnifier.
validateAll
public void validateAll()
- Validate all the components controlled by this magnifier.
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).
setPosition
public void setPosition(int position)
- Set the position of the scrollbar.
repaintAdjusted
public void repaintAdjusted()
- Repaint all the components controlled by this that need to be
repainted.
scrollToValue
public void scrollToValue()
- Scroll the objects controlled by the MagnifyingScrollbar to the
current scrollbar value.
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.
resetMagnificationCenter
public void resetMagnificationCenter()
- Reset centering point of magnifaction to default setting.
All Packages Class Hierarchy This Package Previous Next Index