All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.ScrollingPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----symantec.itools.awt.KeyPressManagerPanel
                                   |
                                   +----symantec.itools.awt.ScrollingPanel

public class ScrollingPanel
extends KeyPressManagerPanel
The ScrollingPanel is a panel with automatic scroll bars. It may contain only one component/container/panel/etc. It automatically tracks the size of this (usually large) component and provides scroll bars so the entire component may be viewed within a panel of limited size. Typically, the added component would be a panel (or some other container) which would then contain a variety of other components.


Variable Index

 o bSun1_1
True if running under Sun Java 1.1, false otherwise.

Constructor Index

 o ScrollingPanel()
Constructs a default ScrollingPanel.
 o ScrollingPanel(Component, int, int)
Constructs a new ScrollingPanel initialized with the specified component, minimum height and minimum width.

Method Index

 o add(Component)
Adds a component to the end of this container.
 o add(Component, int)
Adds a component to the end of this container.
 o add(String, Component)
Adds a component to the end of this container.
 o getComponent()
Gets the current component in the ScrollingPanel.
 o getHorizontalGap()
Gets the current size of the gap between the contained component (panel) in this ScrollingPanel and the horizontal scroll bar.
 o getMinimumHeight()
Gets the value used for the minimumSize() height of the ScrollingPanel.
 o getMinimumWidth()
Gets the current value used for the minimumSize() width of the ScrollingPanel.
 o getScrollLineIncrement()
Gets the number of pixels to scroll for every scrollbar arrow press.
 o getShowHorizontalScroll()
Gets the current horizontal scrollbar visibility flag.
 o getShowVerticalScroll()
Gets the current vertical scrollbar visibility flag.
 o getVerticalGap()
Gets the current size of the gap between the contained component (panel) in this ScrollingPanel and the vertical scroll bar.
 o handleEvent(Event)
Processes events for this component.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o remove(Component)
Removes the specified component from this container.
 o removeAll()
Removes all the components from this container.
 o reshape(int, int, int, int)
Moves and/or resizes this component.
 o scrollDown()
Scrolls down by the number of pixels specified in the method setScrollLineIncrement().
 o scrollHorizontalAbsolute(int)
Scrolls to an absolute horizontal position.
 o scrollLeft()
Scrolls left by the number of pixels specified in the method setScrollLineIncrement().
 o scrollPageDown()
Scrolls one "page" down.
 o scrollPageLeft()
Scrolls one "page" left.
 o scrollPageRight()
Scrolls one "page" right.
 o scrollPageUp()
Scrolls one "page" up.
 o scrollRight()
Scrolls right by the number of pixels specified in the method setScrollLineIncrement().
 o scrollUp()
Scrolls up by the number of pixels specified in the method setScrollLineIncrement().
 o scrollVerticalAbsolute(int)
Scrolls to an absolute vertical position.
 o setComponent(Component)
Sets the component in this ScrollingPanel.
 o setHorizontalGap(int)
Sets the size of the gap between the contained component (panel) in this ScrollingPanel and the horziontal scroll bar.
 o setLayout(LayoutManager)
Takes no action.
 o setMinimumHeight(int)
Sets the value to be used for the minimumSize() height of the ScrollingPanel.
 o setMinimumWidth(int)
Sets the value to be used for the minimumSize() width of the ScrollingPanel.
 o setScrollLineIncrement(int)
Sets the number of pixels to scroll for every scrollbar arrow press.
 o setShowHorizontalScroll(boolean)
Sets whether the horizontal scrollbar should be made visible when necessary or should never be made visible.
 o setShowVerticalScroll(boolean)
Sets whether the vertical scrollbar should be made visible when necessary or should never be made visible.
 o setVerticalGap(int)
Sets the size of the gap between the contained component (panel) in this ScrollingPanel and the vertical scroll bar.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o bSun1_1
  protected boolean bSun1_1
True if running under Sun Java 1.1, false otherwise.

Constructors

 o ScrollingPanel
  public ScrollingPanel()
Constructs a default ScrollingPanel. The panel is initialized with a null component, zero minimum height and zero minimum width.

 o ScrollingPanel
  public ScrollingPanel(Component component,
                        int minWidth,
                        int minHeight)
Constructs a new ScrollingPanel initialized with the specified component, minimum height and minimum width.

Parameters:
component - the component (usually a Panel) to be scrolled
minWidth - the value to be used for the minimumSize() width of the ScrollingPanel
minHeight - the value to be used for the minimumSize() height of the ScrollingPanel

Methods

 o setMinimumWidth
  public void setMinimumWidth(int minWidth)
Sets the value to be used for the minimumSize() width of the ScrollingPanel.

Parameters:
minWidth - the value to be used for the minimumSize() width of the ScrollingPanel
See Also:
getMinimumWidth
 o getMinimumWidth
  public int getMinimumWidth()
Gets the current value used for the minimumSize() width of the ScrollingPanel.

Returns:
the current minimum width value
 o setMinimumHeight
  public void setMinimumHeight(int minHeight)
Sets the value to be used for the minimumSize() height of the ScrollingPanel.

Parameters:
minHeight - the value to be used for the minimumSize() height of the ScrollingPanel
See Also:
getMinimumHeight
 o getMinimumHeight
  public int getMinimumHeight()
Gets the value used for the minimumSize() height of the ScrollingPanel.

Returns:
current minimum height value
See Also:
setMinimumHeight
 o setVerticalGap
  public void setVerticalGap(int gapPixels)
Sets the size of the gap between the contained component (panel) in this ScrollingPanel and the vertical scroll bar. This gap is along the horziontal axis and increases the maximum horizontal scroll value. The default value is 6.

Parameters:
gapPixels - the size of the gap in pixels
See Also:
getVerticalGap, setHorizontalGap
 o getVerticalGap
  public int getVerticalGap()
Gets the current size of the gap between the contained component (panel) in this ScrollingPanel and the vertical scroll bar. This gap is along the horziontal axis and increases the maximum horizontal scroll value. The default value is 6.

Returns:
the current size of the gap in pixels
See Also:
setVerticalGap, getHorizontalGap
 o setHorizontalGap
  public void setHorizontalGap(int gapPixels)
Sets the size of the gap between the contained component (panel) in this ScrollingPanel and the horziontal scroll bar. This gap is along the vertical axis and increases the maximum vertical scroll value. The default value is 6.

Parameters:
gapPixels - the size of the gap in pixels
See Also:
getHorizontalGap, setVerticalGap
 o getHorizontalGap
  public int getHorizontalGap()
Gets the current size of the gap between the contained component (panel) in this ScrollingPanel and the horizontal scroll bar. This gap is along the vertical axis and increases the maximum vertical scroll value. The default value is 6.

Returns:
the current size of the gap in pixels
See Also:
setHorizontalGap, getVerticalGap
 o setShowVerticalScroll
  public void setShowVerticalScroll(boolean cond)
Sets whether the vertical scrollbar should be made visible when necessary or should never be made visible.

Parameters:
cond - if true, show the scrollbar when necessary; if false, never show the scrollbar
See Also:
getShowVerticalScroll, setShowHorizontalScroll
 o getShowVerticalScroll
  public boolean getShowVerticalScroll()
Gets the current vertical scrollbar visibility flag.

Returns:
true if the scroll bar is shown when necessary, false if it is never shown
See Also:
setShowVerticalScroll, getShowHorizontalScroll
 o setShowHorizontalScroll
  public void setShowHorizontalScroll(boolean cond)
Sets whether the horizontal scrollbar should be made visible when necessary or should never be made visible.

Parameters:
cond - if true, show the scrollbar when necessary; if false, never show the scrollbar
See Also:
getShowHorizontalScroll, setShowVerticalScroll
 o getShowHorizontalScroll
  public boolean getShowHorizontalScroll()
Gets the current horizontal scrollbar visibility flag.

Returns:
true if the scroll bar is shown when necessary, false if it is never shown
See Also:
setShowHorizontalScroll, getShowVerticalScroll
 o setScrollLineIncrement
  public void setScrollLineIncrement(int scrollLineIncrement)
Sets the number of pixels to scroll for every scrollbar arrow press. The default is one pixel.

Parameters:
scrollLineIncrement - the number of pixels to scroll per arrow press
See Also:
getScrollLineIncrement
 o getScrollLineIncrement
  public int getScrollLineIncrement()
Gets the number of pixels to scroll for every scrollbar arrow press.

Returns:
the current number of pixels to scroll per arrow press
See Also:
setScrollLineIncrement
 o setComponent
  public void setComponent(Component comp)
Sets the component in this ScrollingPanel. This is the component that gets scrolled. The ScrollingPanel can only contain one component. Any previous component will be removed before the new one is added.

Parameters:
comp - the component to add
See Also:
getComponent
 o getComponent
  public Component getComponent()
Gets the current component in the ScrollingPanel. This is the component that gets scrolled.

Returns:
the current component in the ScrollingPanel
See Also:
setComponent
 o handleEvent
  public boolean handleEvent(Event evt)
Processes events for this component. This is a standard Java AWT method which gets called by the AWT to handle this component's events. The default handler for components dispatches to one of the following methods as needed: action(), gotFocus(), lostFocus(), keyDown(), keyUp(), mouseEnter(), mouseExit(), mouseMove(), mouseDrag(), mouseDown(), or mouseUp(). It is overridden here to handle scrolling events (SCROLL_...).

Parameters:
evt - the event to handle
Returns:
true if the event was handled and no further action is needed, false to pass the event to this component's parent
Overrides:
handleEvent in class KeyPressManagerPanel
See Also:
action, gotFocus, lostFocus, keyDown, keyUp, mouseEnter, mouseExit, mouseMove, mouseDrag, mouseDown, mouseUp
 o update
  public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to prevent the flicker associated with the standard update() method's repainting of the background before painting the component itself.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Container
See Also:
repaint, update
 o scrollUp
  public void scrollUp()
Scrolls up by the number of pixels specified in the method setScrollLineIncrement(). The default is one pixel.

See Also:
scrollDown, scrollLeft, scrollRight, setScrollLineIncrement, getScrollLineIncrement
 o scrollLeft
  public void scrollLeft()
Scrolls left by the number of pixels specified in the method setScrollLineIncrement(). The default is one pixel.

See Also:
scrollRight, scrollUp, scrollDown, setScrollLineIncrement, getScrollLineIncrement
 o scrollDown
  public void scrollDown()
Scrolls down by the number of pixels specified in the method setScrollLineIncrement(). The default is one pixel.

See Also:
scrollUp, scrollLeft, scrollRight, setScrollLineIncrement, getScrollLineIncrement
 o scrollRight
  public void scrollRight()
Scrolls right by the number of pixels specified in the method setScrollLineIncrement(). The default is one pixel.

See Also:
scrollLeft, scrollUp, scrollDown, setScrollLineIncrement, getScrollLineIncrement
 o scrollPageUp
  public void scrollPageUp()
Scrolls one "page" up. The page size is the size of this ScrollingPanel not including the scroll bar, if present.

See Also:
scrollPageDown, scrollPageLeft, scrollPageRight
 o scrollPageLeft
  public void scrollPageLeft()
Scrolls one "page" left. The page size is the size of this ScrollingPanel not including the scroll bar, if present.

See Also:
scrollPageRight, scrollPageUp, scrollPageDown
 o scrollPageDown
  public void scrollPageDown()
Scrolls one "page" down. The page size is the size of this ScrollingPanel not including the scroll bar, if present.

See Also:
scrollPageUp, scrollPageLeft, scrollPageRight
 o scrollPageRight
  public void scrollPageRight()
Scrolls one "page" right. The page size is the size of this ScrollingPanel not including the scroll bar, if present.

See Also:
scrollPageLeft, scrollPageUp, scrollPageDown
 o scrollVerticalAbsolute
  public void scrollVerticalAbsolute(int position)
Scrolls to an absolute vertical position. The contained component's given pixel position will be scrolled to the top line of the scrolling panel. The provided position is constrained to the range [0, component's height - vertical page size].

Parameters:
position - the pixel position to scroll to
See Also:
scrollHorizontalAbsolute
 o scrollHorizontalAbsolute
  public void scrollHorizontalAbsolute(int position)
Scrolls to an absolute horizontal position. The contained component's given pixel position will be scrolled to the leftmost part of the scrolling panel. The provided position is constrained to the range [0, component's width - horizontal page size].

Parameters:
position - the pixel position to scroll to
See Also:
scrollVerticalAbsolute
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component. For each axis, it returns the larger of the current size or the minimum size.

Overrides:
preferredSize in class Container
See Also:
minimumSize
 o minimumSize
  public Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component. The value returned is set using the setMinimumHeight() and setMinimumWidth() methods or when this ScrollingPanel is constructed.

Overrides:
minimumSize in class Container
See Also:
preferredSize, setMinimumHeight, setMinimumWidth
 o add
  public Component add(Component comp)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. Typically, the specified component is added to the end of this container. It is overridden here to set the only component in this ScrollingPanel. This is the component that gets scrolled. The ScrollingPanel can only contain one component. Any previous component will be removed before the new one is added.

Parameters:
comp - the component to add
Returns:
the added component
Overrides:
add in class KeyPressManagerPanel
See Also:
remove, setComponent
 o add
  public synchronized Component add(Component comp,
                                    int pos)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. Typically, the specified component is added to this container at the given zero-relative position index. A position index of -1 would append the component to the end. It is overridden here to set the only component in this ScrollingPanel. This is the component that gets scrolled. The ScrollingPanel can only contain one component. Any previous component will be removed before the new one is added.

Parameters:
comp - the component to add
pos - the zero-relative index at which to add the component or -1 for end (IGNORED)
Returns:
the added component
Overrides:
add in class Container
See Also:
remove, setComponent
 o add
  public synchronized Component add(String name,
                                    Component comp)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. Typically, the specified component is added to the end of this container, and also added to this container's layout manager with the given name. It is overridden here to set the only component in this ScrollingPanel. This is the component that gets scrolled. The ScrollingPanel can only contain one component. Any previous component will be removed before the new one is added.

Parameters:
name - the positioning directive for the layout manager (IGNORED)
comp - the component to add
Returns:
the added component
Overrides:
add in class Container
See Also:
remove, setComponent
 o remove
  public synchronized void remove(Component comp)
Removes the specified component from this container. This is a standard Java AWT method which gets called to remove a component from a container. When this happens the component's removeNotify() will also get called to indicate component removal.

Parameters:
comp - the component to remove
Overrides:
remove in class Container
See Also:
removeAll, add
 o removeAll
  public synchronized void removeAll()
Removes all the components from this container. This is a standard Java AWT method which gets called to remove all the components from a container. When this happens each component's removeNotify() will also get called to indicate component removal.

Overrides:
removeAll in class Container
See Also:
remove, add
 o setLayout
  public void setLayout(LayoutManager mgr)
Takes no action. This is a standard Java AWT method which gets called to specify which layout manager should be used to layout the components in standard containers. Since layout managers CANNOT BE USED with this container the standard setLayout has been OVERRIDDEN for this container and does nothing.

Parameters:
l - the layout manager to use to layout this container's components (IGNORED)
Overrides:
setLayout in class Container
See Also:
getLayout
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
Moves and/or resizes this component. This is a standard Java AWT method which gets called to move and/or resize this component. Components that are in containers with layout managers should not call this method, but rely on the layout manager instead.

Parameters:
x - horizontal position in the parent's coordinate space
y - vertical position in the parent's coordinate space
width - the new width
height - the new height
Overrides:
reshape in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index