public class ScrolledComposite extends Composite
There are two ways to use the ScrolledComposite:
1) Set the size of the control that is being scrolled and the ScrolledComposite will show scrollbars when the contained control can not be fully seen. 2) The second way imitates the way a browser would work. Set the minimum size of the control and the ScrolledComposite will show scroll bars if the visible area is less than the minimum size of the control and it will expand the size of the control if the visible area is greater than the minimum size. This requires invoking both setMinWidth(), setMinHeight() and setExpandHorizontal(), setExpandVertical().
Constructor and Description |
---|
ScrolledComposite(Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of the operating system resources associated with
the receiver and all its descendents.
|
<T> T |
getAdapter(java.lang.Class<T> adapter)
Implementation of the
Adaptable interface. |
boolean |
getAlwaysShowScrollBars()
Returns the Always Show Scrollbars flag.
|
Control |
getContent()
Get the content that is being scrolled.
|
boolean |
getExpandHorizontal()
Returns
true if the content control
will be expanded to fill available horizontal space. |
boolean |
getExpandVertical()
Returns
true if the content control
will be expanded to fill available vertical space. |
int |
getMinHeight()
Returns the minimum height of the content control.
|
int |
getMinWidth()
Returns the minimum width of the content control.
|
Point |
getOrigin()
Return the point in the content that currently appears in the top left
corner of the scrolled composite.
|
boolean |
getShowFocusedControl()
Returns
true if the receiver automatically scrolls to a focused child control
to make it visible. |
void |
setAlwaysShowScrollBars(boolean show)
Set the Always Show Scrollbars flag.
|
void |
setContent(Control content)
Set the content that will be scrolled.
|
void |
setExpandHorizontal(boolean expand)
Configure the ScrolledComposite to resize the content object to be as wide as the
ScrolledComposite when the width of the ScrolledComposite is greater than the
minimum width specified in setMinWidth.
|
void |
setExpandVertical(boolean expand)
Configure the ScrolledComposite to resize the content object to be as tall as the
ScrolledComposite when the height of the ScrolledComposite is greater than the
minimum height specified in setMinHeight.
|
void |
setLayout(Layout layout)
Sets the layout which is associated with the receiver to be
the argument which may be null.
|
void |
setMinHeight(int height)
Specify the minimum height at which the ScrolledComposite will begin scrolling the
content with the vertical scroll bar.
|
void |
setMinSize(int width,
int height)
Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar.
|
void |
setMinSize(Point size)
Specify the minimum width and height at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar.
|
void |
setMinWidth(int width)
Specify the minimum width at which the ScrolledComposite will begin scrolling the
content with the horizontal scroll bar.
|
void |
setOrigin(int left,
int top)
Scrolls the content so that the specified point in the content is in the top
left corner.
|
void |
setOrigin(Point origin)
Scrolls the content so that the specified point in the content is in the top
left corner.
|
void |
setShowFocusedControl(boolean show)
Configure the receiver to automatically scroll to a focused child control
to make it visible.
|
void |
showControl(Control control)
Scrolls the content of the receiver so that the control is visible.
|
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addTouchListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCursor, setData, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, update
addDisposeListener, addListener, checkSubclass, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, toString
public ScrolledComposite(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructjava.lang.IllegalArgumentException
- SWTException
- SWT.H_SCROLL
,
SWT.V_SCROLL
,
Widget.getStyle()
public void setLayout(Layout layout)
Note: No Layout can be set on this Control because it already manages the size and position of its children.
setLayout
in class Composite
layout
- the receiver's new layout or nullSWTException
- public void setOrigin(Point origin)
origin
- the point on the content to appear in the top left cornerSWTException
- public void setOrigin(int left, int top)
left
- the x coordinate of the content to appear in the top left cornertop
- the y coordinate of the content to appear in the top left cornerSWTException
- public Point getOrigin()
SWTException
- public void setAlwaysShowScrollBars(boolean show)
show
- true to show the scrollbars even when not required, false to show scrollbars only when requiredSWTException
- public boolean getAlwaysShowScrollBars()
public boolean getExpandHorizontal()
true
if the content control
will be expanded to fill available horizontal space.SWTException
- public boolean getExpandVertical()
true
if the content control
will be expanded to fill available vertical space.SWTException
- public void setExpandHorizontal(boolean expand)
expand
- true to expand the content control to fill available horizontal spaceSWTException
- public void setExpandVertical(boolean expand)
expand
- true to expand the content control to fill available vertical spaceSWTException
- public void setMinWidth(int width)
width
- the minimum width or 0 for default widthSWTException
- public int getMinWidth()
SWTException
- public void setMinHeight(int height)
height
- the minimum height or 0 for default heightSWTException
- public int getMinHeight()
SWTException
- public void setMinSize(Point size)
size
- the minimum size or null for the default sizeSWTException
- public void setMinSize(int width, int height)
width
- the minimum width or 0 for default widthheight
- the minimum height or 0 for default heightSWTException
- public void setContent(Control content)
content
- the control to be displayed in the content areaSWTException
- public Control getContent()
public void setShowFocusedControl(boolean show)
false
, show a focused control is off.
By default, show a focused control is off.show
- true
to show a focused control.SWTException
- public boolean getShowFocusedControl()
true
if the receiver automatically scrolls to a focused child control
to make it visible. Otherwise, returns false
.SWTException
- public void showControl(Control control)
control
- the control to be shownjava.lang.IllegalArgumentException
- SWTException
- public void dispose()
Widget
true
when sent the message isDisposed()
.
Any internal connections between the widgets in the tree will
have been removed to facilitate garbage collection.
NOTE: This method is not called recursively on the descendents
of the receiver. This means that, widget implementers can not
detect when a widget is being disposed of by re-implementing
this method, but should instead listen for the Dispose
event.
public <T> T getAdapter(java.lang.Class<T> adapter)
Widget
Adaptable
interface.
IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
getAdapter
in interface Adaptable
getAdapter
in class Composite
adapter
- the lookup classnull
if
there is no adapter associated with the given class.
Copyright (c) EclipseSource and others 2002, 2016.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0