class org.aswing.JScrollPane extends Container
JScrollPane is a container with two scrollbar controllin the viewport's beeing viewed area.
If you want to change the unit or block increment of the scrollbars in a scrollpane, you shoud
controll it with viewport instead of scrollbar directly, because the scrollbar's increment will
be set to same to viewport's always. I mean use JViewport.horizontalUnitIncrement
instead of
JScrollBar.unitIncrement
@see org.aswing.Viewportable @see org.aswing.JViewport @see org.aswing.JScrollBar @author paling
![]() | Show Events | Hide Events
|
Class Fields
Instance Fields
var viewport:Viewportable
The viewport
Most applications will find it more convenient to use
#setView
to add a viewport or a view to the scrollpane.
@see #view @see org.aswing.JList @see org.aswing.JTextArea @see org.aswing.JTable
function new(?viewOrViewport:Dynamic = null, ?vsbPolicy:Int = 0, ?hsbPolicy:Int = 0): Void
Create a JScrollPane, you can specified a Component to be view,
then here will create a JViewport
to manager the view's scroll,
or a Viewportable to be the view, it mananger the scroll itself.
If view is not instanceof either, no view will be viewed.
@throw TypeError when viewOrViewport is not component or viewportable. @see #SCROLLBARASNEEDED @see #SCROLLBARNEVER @see #SCROLLBARALWAYS @see #setViewportView() @see #setViewport() @see org.aswing.Viewportable @see org.aswing.JViewport @see org.aswing.JList @see org.aswing.JTextArea
viewOrViewport | the scroll content component or a Viewportable |
vsbPolicy |
|
hsbPolicy |
|
function addAdjustmentListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Adds a scrollbar scrolled listener. @see org.aswing.event.ScrollPaneEvent#SCROLLBARSTATECHANGED
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function getViewportView(): Component
Returns the view currently in the scrollpane's viewport if the viewport is a JViewport instance, otherwise, null will be returned.
function getVisibleRect(): IntRectangle
Returns the visible extent rectangle related the current scroll properties.
returns | the visible extent rectangle |
function removeAdjustmentListener(listener:Dynamic ->Void): Void
Removes a state listener. @see org.aswing.event.ScrollPaneEvent#SCROLLBARSTATECHANGED
listener | the listener to be removed. |
function setView(viewOrViewport:Dynamic): Void
Sets the view to viewed and scrolled by this scrollpane.
if this view is not a Viewportable implementation,
then here will create a JViewport to manager the view's scroll,
else the Viewportable will be the viewport.
If view is not instanceof either, no view will be set.
If you want to make a component viewed by your way, you have two way:
- 1.Make your component a
Viewportable
implementation. - 2.Make a your new
Viewportable
likesJViewport
, recommend you extends theJViewport
, then make your component to be the viewport's view likeJViewport
does.
viewOrViewport | a component or a Viewportable object. |
function setViewportView(view:Component): Void
If currently viewport is a JViewport
instance,
set the view to it. If not, then creates a JViewport
and then sets this view.
Applications that don't provide the view directly to the JScrollPane
constructor should use this method to specify the scrollable child that's going
to be displayed in the scrollpane. For example:
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll);Applications should not add children directly to the scrollpane.
@see #setViewport() @see org.aswing.JViewport#setView()
view | the component to add to the viewport |