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.
-
SCROLLBAR_ALWAYS
- Specifies that horizontal/vertical scrollbars should always be shown
regardless of the respective sizes of the scrollpane and child.
-
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.
-
SCROLLBAR_NEVER
- Specifies that horizontal/vertical scrollbars should never be shown
regardless of the respective sizes of the scrollpane and child.
-
ScrollPaneGadget()
- Create a new scrollpane container with a scrollbar display policy of "as needed".
-
add(Gadget, int)
- Adds the specified gadget to this scroll pane container.
-
adjustmentValueChanged(AdjustmentEvent)
- adjustmentValueChanged
-
childrenCanOverlap()
- returns true if children can overlap each other.
-
doLayout()
- Lays out this container by resizing its child to its preferred size.
-
getHAdjustable()
- Returns the Adjustable object which represents the state of the horizontal
scrollbar.
-
getHorizontalScrollbarDisplayPolicy()
- setHorizontalScrollbarDisplayPolicy
-
getHScrollbar()
- Returns the hScrollbar to any menber of this package
-
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.
-
getMinimumSize()
- gets the minimum size
-
getOuterPreferredSize()
- getOuterPreferredSize
-
getPreferredSize()
- gets the preferred size
-
getScrolledGadget()
- Returns the gadget being scrolled.
-
getScrolledMinimumSize()
- getScrolledMinimumSize
-
getScrolledPreferredSize()
- Override this in a subclass if you want the scrolled pane
to default to a certain size.
-
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.
-
getVAdjustable()
- Returns the Adjustable object which represents the state of the vertical
scrollbar.
-
getVerticalScrollbarDisplayPolicy()
- getVerticalScrollbarDisplayPolicy
-
getViewport()
- Returns the current size of the scroll pane's view port.
-
getVScrollbar()
- Returns the vScrollbar to any menber of this package
-
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.
-
isNormalizingScrolled()
- isNormalizingScrolled
-
isShrinkingHorizontal()
- isShrinkingHorizontal
-
isShrinkingVertical()
- isShrinkingVertical
-
isStretchingHorizontal()
- isStretchingHorizontal
-
isStretchingVertical()
- isStretchingVertical
-
overrideHorizontalScrollbar(ScrollbarGadget)
- overrideHorizontalScrollbar
-
overrideVerticalScrollbar(ScrollbarGadget)
- overrideVerticalScrollbar
-
processKeyEvent(KeyEvent)
- processKeyEvent
-
resizeScrolled(Gadget, PanelGadget, int, int, int, int)
- resizeScrolled
-
resizeScrolled(Gadget, PanelGadget, int, int, int, int, boolean)
- resizeScrolled
-
setActiveUpdate(boolean)
- Sets the scrollbars' active update flag
-
setAutoScrolling(boolean)
- Sets the scrollbars' auto scrolling flag
-
setHorizontalScrollbarDisplayPolicy(int)
- getHorizontalScrollbarDisplayPolicy
-
setLayout(GadgetLayoutManager)
- Sets the layout manager for this container.
-
setNormalizingScrolled(boolean)
- setNormalizingScrolled
-
setScrollPosition(int, int)
- Scrolls to the specified position within the child gadget.
-
setScrollPosition(Point)
- Scrolls to the specified position within the child gadget.
-
setShrinkingHorizontal(boolean)
- setShrinkingHorizontal
-
setShrinkingVertical(boolean)
- setShrinkingVertical
-
setStretchingHorizontal(boolean)
- setStretchingHorizontal
-
setStretchingVertical(boolean)
- setStretchingVertical
-
setVerticalScrollbarDisplayPolicy(int)
- setVerticalScrollbarDisplayPolicy
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.
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.
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.
ScrollPaneGadget
public ScrollPaneGadget()
- Create a new scrollpane container with a scrollbar display policy of "as needed".
childrenCanOverlap
public boolean childrenCanOverlap()
- returns true if children can overlap each other.
- Returns:
- false
- Overrides:
- childrenCanOverlap in class ContainerGadget
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.
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.
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
isStretchingHorizontal
public boolean isStretchingHorizontal()
- isStretchingHorizontal
- Returns:
- boolean
setStretchingHorizontal
public void setStretchingHorizontal(boolean stretchingHorizontal)
- setStretchingHorizontal
- Parameters:
- stretchingHorizontal - description
isStretchingVertical
public boolean isStretchingVertical()
- isStretchingVertical
- Returns:
- boolean
setStretchingVertical
public void setStretchingVertical(boolean stretchingVertical)
- setStretchingVertical
- Parameters:
- stretchingVertical - description
isShrinkingHorizontal
public boolean isShrinkingHorizontal()
- isShrinkingHorizontal
- Returns:
- boolean
setShrinkingHorizontal
public void setShrinkingHorizontal(boolean shrinkingHorizontal)
- setShrinkingHorizontal
- Parameters:
- shrinkingHorizontal - description
isShrinkingVertical
public boolean isShrinkingVertical()
- isShrinkingVertical
- Returns:
- boolean
setShrinkingVertical
public void setShrinkingVertical(boolean shrinkingVertical)
- setShrinkingVertical
- Parameters:
- shrinkingVertical - description
isNormalizingScrolled
public boolean isNormalizingScrolled()
- isNormalizingScrolled
- Returns:
- boolean
setNormalizingScrolled
public void setNormalizingScrolled(boolean normalizingScrolled)
- setNormalizingScrolled
- Parameters:
- normalizingScrolled - description
getVerticalScrollbarDisplayPolicy
public int getVerticalScrollbarDisplayPolicy()
- getVerticalScrollbarDisplayPolicy
- Returns:
- int
setVerticalScrollbarDisplayPolicy
public void setVerticalScrollbarDisplayPolicy(int verticalScrollbarDisplayPolicy)
- setVerticalScrollbarDisplayPolicy
- Parameters:
- verticalScrollbarDisplayPolicy - description
getHorizontalScrollbarDisplayPolicy
public int getHorizontalScrollbarDisplayPolicy()
- setHorizontalScrollbarDisplayPolicy
- Returns:
- int
setHorizontalScrollbarDisplayPolicy
public void setHorizontalScrollbarDisplayPolicy(int horizontalScrollbarDisplayPolicy)
- getHorizontalScrollbarDisplayPolicy
- Parameters:
- horizontalScrollbarDisplayPolicy - description
getHScrollbar
protected ScrollbarGadget getHScrollbar()
- Returns the hScrollbar to any menber of this package
- Returns:
- ScrollbarGadget
getVScrollbar
protected ScrollbarGadget getVScrollbar()
- Returns the vScrollbar to any menber of this package
- Returns:
- ScrollbarGadget
getViewport
public Gadget getViewport()
- Returns the current size of the scroll pane's view port.
- Returns:
- Gadget
getScrolledGadget
public Gadget getScrolledGadget()
- Returns the gadget being scrolled.
- Returns:
- Gadget
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
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
getVAdjustable
public final Adjustable getVAdjustable()
- Returns the Adjustable object which represents the state of the vertical
scrollbar.
- Returns:
- java11.awt.Adjustable
getHAdjustable
public final Adjustable getHAdjustable()
- Returns the Adjustable object which represents the state of the horizontal
scrollbar.
- Returns:
- java11.awt.Adjustable
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
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
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
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
getScrolledPreferredSize
public Dimension getScrolledPreferredSize()
- Override this in a subclass if you want the scrolled pane
to default to a certain size.
- Returns:
- Dimension
getScrolledMinimumSize
public Dimension getScrolledMinimumSize()
- getScrolledMinimumSize
- Returns:
- Dimension
getOuterPreferredSize
public Dimension getOuterPreferredSize()
- getOuterPreferredSize
- Returns:
- Dimension
getMinimumSize
public Dimension getMinimumSize()
- gets the minimum size
- Returns:
- Dimension
- Overrides:
- getMinimumSize in class ContainerGadget
getPreferredSize
public Dimension getPreferredSize()
- gets the preferred size
- Returns:
- Dimension
- Overrides:
- getPreferredSize in class ContainerGadget
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
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
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
overrideHorizontalScrollbar
public boolean overrideHorizontalScrollbar(ScrollbarGadget sb)
- overrideHorizontalScrollbar
- Parameters:
- sb - description
- Returns:
- boolean
overrideVerticalScrollbar
public boolean overrideVerticalScrollbar(ScrollbarGadget sb)
- overrideVerticalScrollbar
- Parameters:
- sb - description
- Returns:
- boolean
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
- adjustmentValueChanged
- Parameters:
- e - description
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