All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dtai.gwt.ScrollPaneGadget

java.lang.Object
   |
   +----dtai.gwt.Gadget
           |
           +----dtai.gwt.ContainerGadget
                   |
                   +----dtai.gwt.PanelGadget
                           |
                           +----dtai.gwt.BorderGadget
                                   |
                                   +----dtai.gwt.ScrollPaneGadget

public class ScrollPaneGadget
extends BorderGadget
implements AdjustmentListener
A container class which implements automatic horizontal and/or vertical scrolling for a single child gadget. The display policy for the scrollbars can be set to: 1.as needed: scrollbars created and shown only when needed by scrollpane 2.always: scrollbars created and always shown by the scrollpane 3.never: scrollbars never created or shown by the scrollpane The state of the horizontal and vertical scrollbars is represented by two objects (one for each dimension) which implement the Adjustable interface. The API provides methods to access those objects such that the attributes on the Adjustable object (such as unitIncrement, value, etc.) can be manipulated. Certain adjustable properties (minimum, maximum, blockIncrement, and visibleAmount) are set internally by the scrollpane in accordance with the geometry of the scrollpane and its child and these should not be set by programs using the scrollpane. If the scrollbar display policy is defined as "never", then the scrollpane can still be programmatically scrolled using the setScrollPosition() method and the scrollpane will move and clip the child's contents appropriately. This policy is useful if the program needs to create and manage its own adjustable controls. The placement of the scrollbars is controlled by platform-specific properties set by the user outside of the program. The initial size of this container is set to 100x100, but can be reset using setSize(). Insets are used to define any space used by scrollbars and any borders created by the scroll pane. I DON'T HANDLE THIS RIGHT NOW, BUT IN AWT: getInsets() can be used to get the current value for the insets. If the value of scrollbarsAlwaysVisible is false, then the value of the insets will change dynamically depending on whether the scrollbars are currently visible or not.


Variable Index

 o SCROLLBAR_ALWAYS
Specifies that horizontal/vertical scrollbars should always be shown regardless of the respective sizes of the scrollpane and child.
 o SCROLLBAR_AS_NEEDED
Specifies that horizontal/vertical scrollbar should be shown only when the size of the child exceeds the size of the scrollpane in the horizontal/vertical dimension.
 o SCROLLBAR_NEVER
Specifies that horizontal/vertical scrollbars should never be shown regardless of the respective sizes of the scrollpane and child.

Constructor Index

 o ScrollPaneGadget()
Create a new scrollpane container with a scrollbar display policy of "as needed".

Method Index

 o add(Gadget, int)
Adds the specified gadget to this scroll pane container.
 o adjustmentValueChanged(AdjustmentEvent)
adjustmentValueChanged
 o childrenCanOverlap()
returns true if children can overlap each other.
 o doLayout()
Lays out this container by resizing its child to its preferred size.
 o getHAdjustable()
Returns the Adjustable object which represents the state of the horizontal scrollbar.
 o getHorizontalScrollbarDisplayPolicy()
setHorizontalScrollbarDisplayPolicy
 o getHScrollbar()
Returns the hScrollbar to any menber of this package
 o getHScrollbarHeight()
Returns the height that would be occupied by a horizontal scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.
 o getMinimumSize()
gets the minimum size
 o getOuterPreferredSize()
getOuterPreferredSize
 o getPreferredSize()
gets the preferred size
 o getScrolledGadget()
Returns the gadget being scrolled.
 o getScrolledMinimumSize()
getScrolledMinimumSize
 o getScrolledPreferredSize()
Override this in a subclass if you want the scrolled pane to default to a certain size.
 o getScrollPosition()
Returns the current x,y position within the child which is displayed at the 0,0 location of the scrolled panel's view port.
 o getVAdjustable()
Returns the Adjustable object which represents the state of the vertical scrollbar.
 o getVerticalScrollbarDisplayPolicy()
getVerticalScrollbarDisplayPolicy
 o getViewport()
Returns the current size of the scroll pane's view port.
 o getVScrollbar()
Returns the vScrollbar to any menber of this package
 o getVScrollbarWidth()
Returns the width that would be occupied by a vertical scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.
 o isNormalizingScrolled()
isNormalizingScrolled
 o isShrinkingHorizontal()
isShrinkingHorizontal
 o isShrinkingVertical()
isShrinkingVertical
 o isStretchingHorizontal()
isStretchingHorizontal
 o isStretchingVertical()
isStretchingVertical
 o overrideHorizontalScrollbar(ScrollbarGadget)
overrideHorizontalScrollbar
 o overrideVerticalScrollbar(ScrollbarGadget)
overrideVerticalScrollbar
 o processKeyEvent(KeyEvent)
processKeyEvent
 o resizeScrolled(Gadget, PanelGadget, int, int, int, int)
resizeScrolled
 o resizeScrolled(Gadget, PanelGadget, int, int, int, int, boolean)
resizeScrolled
 o setActiveUpdate(boolean)
Sets the scrollbars' active update flag
 o setAutoScrolling(boolean)
Sets the scrollbars' auto scrolling flag
 o setHorizontalScrollbarDisplayPolicy(int)
getHorizontalScrollbarDisplayPolicy
 o setLayout(GadgetLayoutManager)
Sets the layout manager for this container.
 o setNormalizingScrolled(boolean)
setNormalizingScrolled
 o setScrollPosition(int, int)
Scrolls to the specified position within the child gadget.
 o setScrollPosition(Point)
Scrolls to the specified position within the child gadget.
 o setShrinkingHorizontal(boolean)
setShrinkingHorizontal
 o setShrinkingVertical(boolean)
setShrinkingVertical
 o setStretchingHorizontal(boolean)
setStretchingHorizontal
 o setStretchingVertical(boolean)
setStretchingVertical
 o setVerticalScrollbarDisplayPolicy(int)
setVerticalScrollbarDisplayPolicy

Variables

 o SCROLLBAR_AS_NEEDED
 public static final int SCROLLBAR_AS_NEEDED
Specifies that horizontal/vertical scrollbar should be shown only when the size of the child exceeds the size of the scrollpane in the horizontal/vertical dimension.

 o SCROLLBAR_ALWAYS
 public static final int SCROLLBAR_ALWAYS
Specifies that horizontal/vertical scrollbars should always be shown regardless of the respective sizes of the scrollpane and child.

 o SCROLLBAR_NEVER
 public static final int SCROLLBAR_NEVER
Specifies that horizontal/vertical scrollbars should never be shown regardless of the respective sizes of the scrollpane and child.

Constructors

 o ScrollPaneGadget
 public ScrollPaneGadget()
Create a new scrollpane container with a scrollbar display policy of "as needed".

Methods

 o childrenCanOverlap
 public boolean childrenCanOverlap()
returns true if children can overlap each other.

Returns:
false
Overrides:
childrenCanOverlap in class ContainerGadget
 o setActiveUpdate
 public void setActiveUpdate(boolean activeUpdate)
Sets the scrollbars' active update flag

Parameters:
activeUpdate - if true (usually the default) the scrollbar will update the display while dragging.
 o setAutoScrolling
 public void setAutoScrolling(boolean autoScroll)
Sets the scrollbars' auto scrolling flag

Parameters:
autoScroll - if true (usually the default) the user can hold down the scroll buttons or drag area to automatically scroll.
 o add
 public Gadget add(Gadget gadget,
                   int pos)
Adds the specified gadget to this scroll pane container. If the scroll pane has an existing child gadget, that gadget is removed and the new one is added. Overrides: add in class Container

Parameters:
gadget - - the gadget to be added
pos - - position of child gadget (must be <= 0)
Returns:
Gadget
Overrides:
add in class ContainerGadget
 o isStretchingHorizontal
 public boolean isStretchingHorizontal()
isStretchingHorizontal

Returns:
boolean
 o setStretchingHorizontal
 public void setStretchingHorizontal(boolean stretchingHorizontal)
setStretchingHorizontal

Parameters:
stretchingHorizontal - description
 o isStretchingVertical
 public boolean isStretchingVertical()
isStretchingVertical

Returns:
boolean
 o setStretchingVertical
 public void setStretchingVertical(boolean stretchingVertical)
setStretchingVertical

Parameters:
stretchingVertical - description
 o isShrinkingHorizontal
 public boolean isShrinkingHorizontal()
isShrinkingHorizontal

Returns:
boolean
 o setShrinkingHorizontal
 public void setShrinkingHorizontal(boolean shrinkingHorizontal)
setShrinkingHorizontal

Parameters:
shrinkingHorizontal - description
 o isShrinkingVertical
 public boolean isShrinkingVertical()
isShrinkingVertical

Returns:
boolean
 o setShrinkingVertical
 public void setShrinkingVertical(boolean shrinkingVertical)
setShrinkingVertical

Parameters:
shrinkingVertical - description
 o isNormalizingScrolled
 public boolean isNormalizingScrolled()
isNormalizingScrolled

Returns:
boolean
 o setNormalizingScrolled
 public void setNormalizingScrolled(boolean normalizingScrolled)
setNormalizingScrolled

Parameters:
normalizingScrolled - description
 o getVerticalScrollbarDisplayPolicy
 public int getVerticalScrollbarDisplayPolicy()
getVerticalScrollbarDisplayPolicy

Returns:
int
 o setVerticalScrollbarDisplayPolicy
 public void setVerticalScrollbarDisplayPolicy(int verticalScrollbarDisplayPolicy)
setVerticalScrollbarDisplayPolicy

Parameters:
verticalScrollbarDisplayPolicy - description
 o getHorizontalScrollbarDisplayPolicy
 public int getHorizontalScrollbarDisplayPolicy()
setHorizontalScrollbarDisplayPolicy

Returns:
int
 o setHorizontalScrollbarDisplayPolicy
 public void setHorizontalScrollbarDisplayPolicy(int horizontalScrollbarDisplayPolicy)
getHorizontalScrollbarDisplayPolicy

Parameters:
horizontalScrollbarDisplayPolicy - description
 o getHScrollbar
 protected ScrollbarGadget getHScrollbar()
Returns the hScrollbar to any menber of this package

Returns:
ScrollbarGadget
 o getVScrollbar
 protected ScrollbarGadget getVScrollbar()
Returns the vScrollbar to any menber of this package

Returns:
ScrollbarGadget
 o getViewport
 public Gadget getViewport()
Returns the current size of the scroll pane's view port.

Returns:
Gadget
 o getScrolledGadget
 public Gadget getScrolledGadget()
Returns the gadget being scrolled.

Returns:
Gadget
 o getHScrollbarHeight
 public final int getHScrollbarHeight()
Returns the height that would be occupied by a horizontal scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.

Returns:
int
 o getVScrollbarWidth
 public final int getVScrollbarWidth()
Returns the width that would be occupied by a vertical scrollbar, which is independent of whether it is currently displayed by the scroll pane or not.

Returns:
int
 o getVAdjustable
 public final Adjustable getVAdjustable()
Returns the Adjustable object which represents the state of the vertical scrollbar.

Returns:
java11.awt.Adjustable
 o getHAdjustable
 public final Adjustable getHAdjustable()
Returns the Adjustable object which represents the state of the horizontal scrollbar.

Returns:
java11.awt.Adjustable
 o setScrollPosition
 public void setScrollPosition(int x,
                               int y)
Scrolls to the specified position within the child gadget. A call to this method is only valid if the scroll pane contains a child and the specified position is within legal scrolling bounds of the child. Legal bounds are defined to be the rectangle: x = 0, y = 0, width = (child width - view port width), height = (child height - view port height). This is a convenience method which interfaces with the Adjustable objects which respresent the state of the scrollbars. Throws: IllegalArgumentException if specified coordinates are not within the legal scrolling bounds of the child gadget.

Parameters:
x - - the x position to scroll to
y - - the y position to scroll to
 o setScrollPosition
 public final void setScrollPosition(Point p)
Scrolls to the specified position within the child gadget. A call to this method is only valid if the scroll pane contains a child and the specified position is within legal scrolling bounds of the child. Legal bounds are defined to be the rectangle: x = 0, y = 0, width = (child width - view port width), height = (child height - view port height). This is a convenience method which interfaces with the Adjustable objects which respresent the state of the scrollbars. Throws: IllegalArgumentException if specified coordinates are not within the legal scrolling bounds of the child gadget.

Parameters:
p - - the Point representing the position to scroll to
 o getScrollPosition
 public Point getScrollPosition()
Returns the current x,y position within the child which is displayed at the 0,0 location of the scrolled panel's view port. This is a convenience method which interfaces with the adjustable objects which respresent the state of the scrollbars.

Returns:
s the coordinate position for the current scroll position
 o setLayout
 public final void setLayout(GadgetLayoutManager mgr)
Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set. Overrides: setLayout in class Container

Parameters:
mgr - - the specified layout manager
Overrides:
setLayout in class ContainerGadget
 o getScrolledPreferredSize
 public Dimension getScrolledPreferredSize()
Override this in a subclass if you want the scrolled pane to default to a certain size.

Returns:
Dimension
 o getScrolledMinimumSize
 public Dimension getScrolledMinimumSize()
getScrolledMinimumSize

Returns:
Dimension
 o getOuterPreferredSize
 public Dimension getOuterPreferredSize()
getOuterPreferredSize

Returns:
Dimension
 o getMinimumSize
 public Dimension getMinimumSize()
gets the minimum size

Returns:
Dimension
Overrides:
getMinimumSize in class ContainerGadget
 o getPreferredSize
 public Dimension getPreferredSize()
gets the preferred size

Returns:
Dimension
Overrides:
getPreferredSize in class ContainerGadget
 o doLayout
 public void doLayout()
Lays out this container by resizing its child to its preferred size. If the new preferred size of the child causes the current scroll position to be invalid, the scroll position is set to the closest valid position. Overrides: doLayout in class Container

Overrides:
doLayout in class ContainerGadget
See Also:
validate
 o resizeScrolled
 public void resizeScrolled(Gadget scrolledGadget,
                            PanelGadget viewport,
                            int x,
                            int y,
                            int width,
                            int height)
resizeScrolled

Parameters:
scrolledGadget - description
viewport - description
x - description
y - description
width - description
height - description
 o resizeScrolled
 public void resizeScrolled(Gadget scrolledGadget,
                            PanelGadget viewport,
                            int x,
                            int y,
                            int width,
                            int height,
                            boolean invalidateParent)
resizeScrolled

Parameters:
scrolledGadget - description
viewport - description
x - description
y - description
width - description
height - description
invalidate - description
 o overrideHorizontalScrollbar
 public boolean overrideHorizontalScrollbar(ScrollbarGadget sb)
overrideHorizontalScrollbar

Parameters:
sb - description
Returns:
boolean
 o overrideVerticalScrollbar
 public boolean overrideVerticalScrollbar(ScrollbarGadget sb)
overrideVerticalScrollbar

Parameters:
sb - description
Returns:
boolean
 o adjustmentValueChanged
 public void adjustmentValueChanged(AdjustmentEvent e)
adjustmentValueChanged

Parameters:
e - description
 o processKeyEvent
 protected void processKeyEvent(KeyEvent e)
processKeyEvent

Parameters:
e - the KeyEvent
Overrides:
processKeyEvent in class Gadget

All Packages  Class Hierarchy  This Package  Previous  Next  Index