org.gnu.gtk
Class ScrolledWindow

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.gnu.glib.GObject
          extended by org.gnu.gtk.GtkObject
              extended by org.gnu.gtk.Widget
                  extended by org.gnu.gtk.Container
                      extended by org.gnu.gtk.Bin
                          extended by org.gnu.gtk.ScrolledWindow

public class ScrolledWindow
extends Bin

A ScrolledWindow is a Bin subclass; it's a container that accepts a single child widget. ScrolledWindow adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.

The ScrolledWindow works in two ways. Some Widgets have native scrolling support; these widgets have "slots" for Adjustment objects.

For Widgets that lack native scrolling support the Viewport Widget acts as an adaptor class, implementing scrollability for child Widgets that lack their own scrolling capability.

If a Widget has native scrolling capabilities it can be added with the add method. If a Widget does not, you must first add the Widget to a Viewport and then add the Viewport to the ScrolledWindow. The convenience method addWithViewport does exactly this, so you can ignore the presence of the Viewport.

The position of the scrollbars is controlled by the scroll adjustments. See Adjustment for details on how to determine the position of the layout.


Constructor Summary
ScrolledWindow()
          Creates a new ScrolledWindow object.
ScrolledWindow(Adjustment hadj, Adjustment vadj)
          Create a new ScrolledWindow object.
ScrolledWindow(org.gnu.glib.Handle handle)
          Construct a ScrolledWindow using a handle to a native resource.
 
Method Summary
 void addWithViewport(Widget child)
          Used to add children without native scrolling capability.
 Adjustment getHAdjustment()
          Returns the horizontal Scrollbar's Adjustment.
 HScrollBar getHScrollBar()
          Return the horizontal ScrollBar.
static ScrolledWindow getScrolledWindow(org.gnu.glib.Handle handle)
          Internal static factory method to be used by Java-Gnome only.
static Type getType()
          Retrieve the runtime type used by the GLib library.
 Adjustment getVAdjustment()
          Returns the vertical Scrollbar's Adjustment.
 VScrollBar getVScrollBar()
          Return the vertical ScrollBar.
 void setHAdjustment(Adjustment hadj)
          Sets the horizontal Scrollbar's Adjustment.
 void setPlacement(CornerType windowPlacement)
          Determines the location of the child widget with respect to the scrollbars.
 void setPolicy(PolicyType hScrollBarPolicy, PolicyType vScrollBarPolicy)
          Sets the scrollbar policy for the horizontal and vertical scrollbars.
 void setShadowType(ShadowType type)
          Changes the type of shadow drawn around the contents of the ScrolledWindow.
 void setVAdjustment(Adjustment vadj)
          Sets the vertical Scrollbar's Adjustment.
 
Methods inherited from class org.gnu.gtk.Bin
getChild
 
Methods inherited from class org.gnu.gtk.Container
add, addListener, getBooleanChildProperty, getBorderWidth, getChildProperty, getChildren, getEventListenerClass, getEventType, getIntChildProperty, getResizeMode, remove, removeListener, resizeChildren, setBooleanChildProperty, setBorderWidth, setChildProperty, setIntChildProperty, setResizeMode
 
Methods inherited from class org.gnu.gtk.Widget
activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight
 
Methods inherited from class org.gnu.gtk.GtkObject
destroy, sink
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScrolledWindow

public ScrolledWindow(Adjustment hadj,
                      Adjustment vadj)
Create a new ScrolledWindow object. The two arguments are the ScrolledWindow's Adjustments; these will be shared with the scrollbars and the child widgets to keep the bars in sync with the child.

Parameters:
hadj - The horizontal Adjustment.
vadj - The vertical Adjustment.

ScrolledWindow

public ScrolledWindow()
Creates a new ScrolledWindow object. This constuctor generates Adjustments automatically.


ScrolledWindow

public ScrolledWindow(org.gnu.glib.Handle handle)
Construct a ScrolledWindow using a handle to a native resource.

Method Detail

getScrolledWindow

public static ScrolledWindow getScrolledWindow(org.gnu.glib.Handle handle)
Internal static factory method to be used by Java-Gnome only.


getHAdjustment

public Adjustment getHAdjustment()
Returns the horizontal Scrollbar's Adjustment. This can be used to connect the horizontal Scrollbar to the child Widget's horizontal scroll functionality.

Returns:
The horizontal Scrollbar's Adjustment.

setHAdjustment

public void setHAdjustment(Adjustment hadj)
Sets the horizontal Scrollbar's Adjustment.

Parameters:
hadj - The horizontal Adjustment.

getVAdjustment

public Adjustment getVAdjustment()
Returns the vertical Scrollbar's Adjustment. This can be used to connect the vertical Scrollbar to the child Widget's vertical scroll functionality.

Returns:
The vertical Scrollbar's Adjustment.

setVAdjustment

public void setVAdjustment(Adjustment vadj)
Sets the vertical Scrollbar's Adjustment.

Parameters:
vadj - The vertical Adjustment.

setPolicy

public void setPolicy(PolicyType hScrollBarPolicy,
                      PolicyType vScrollBarPolicy)
Sets the scrollbar policy for the horizontal and vertical scrollbars. The policy determines when the scrollbar should appear.

Parameters:
hScrollBarPolicy - The policy for the horizontal ScrollBar.
vScrollBarPolicy - The policy for the vertical ScrollBar.

addWithViewport

public void addWithViewport(Widget child)
Used to add children without native scrolling capability. This is simply a convenience method, it is equivalent to adding the unscrollable child to a Viewport, then adding the Viewport to the ScrolledWindow.

Parameters:
child - The Widget to add to the ScrolledWindow.

setPlacement

public void setPlacement(CornerType windowPlacement)
Determines the location of the child widget with respect to the scrollbars. The default is CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbar underneath and to the right.

Parameters:
windowPlacement - The placement for the child widget.

setShadowType

public void setShadowType(ShadowType type)
Changes the type of shadow drawn around the contents of the ScrolledWindow.

Parameters:
type - The type of shadow to draw.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.


getHScrollBar

public HScrollBar getHScrollBar()
Return the horizontal ScrollBar.


getVScrollBar

public VScrollBar getVScrollBar()
Return the vertical ScrollBar.