new JScrollPane()
public function JScrollPane(viewOrViewport:Object, vsbPolicy:Number, hsbPolicy:Number)
JScrollPane(view:Component, vsbPolicy:Number, hsbPolicy:Number)
JScrollPane(view:Component, vsbPolicy:Number)
JScrollPane(view:Component)
JScrollPane(viewport:Viewportable, vsbPolicy:Number, hsbPolicy:Number)
JScrollPane(viewport:Viewportable, vsbPolicy:Number)
JScrollPane(viewport:Viewportable)
JScrollPane()
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.
viewOrViewport | the scroll content component or a Viewportable |
vsbPolicy | SCROLLBAR_AS_NEEDED or SCROLLBAR_NEVER or SCROLLBAR_ALWAYS, default SCROLLBAR_AS_NEEDED |
hsbPolicy | SCROLLBAR_AS_NEEDED or SCROLLBAR_NEVER or SCROLLBAR_ALWAYS, default SCROLLBAR_AS_NEEDED |
static public ON_ADJUSTMENT_VALUE_CHANGED:String
static public ON_VIEWPORT_CHANGED:String
static public SCROLLBAR_AS_NEEDED:Number
static public SCROLLBAR_NEVER:Number
static public SCROLLBAR_ALWAYS:Number
public function updateUI():Void
Description copied from Component
Resets the UI property to a value from the current look and feel.
Component
subclasses must override this method
like this:
public void updateUI() { setUI((SliderUI)UIManager.getUI(this); }
public function setUI(newUI:ScrollPaneUI):Void
Description copied from Component
Sets the look and feel delegate for this component.
Component
subclasses generally override this method
to narrow the argument type. For example, in JSlider
:
public void setUI(SliderUI newUI) { super.setUI(newUI); }
Additionally Component
subclasses must provide a
getUI
method that returns the correct type. For example:
public SliderUI getUI() { return (SliderUI)ui; }
public function getUIClassID():String
Description copied from Component
Returns the UIDefaults
key used to
look up the name of the org.aswing.plaf.ComponentUI
class that defines the look and feel
for this component. Most applications will never need to
call this method. Subclasses of Component
that support
pluggable look and feel should override this method to
return a UIDefaults
key that maps to the
ComponentUI
subclass that defines their look and feel.
public function setLayout(layout:LayoutManager):Void
Error | when the layout is not ScrollPaneLayout instance. |
public function setView(viewOrViewport:Object):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:
Viewportable
implementation.
Viewportable
likes JViewport
, recommend
you extends the JViewport
, then make your component to be the viewport's view like
JViewport
does.
setView(view:Component)
setView(view:Viewportable)
viewOrViewport | a component or a Viewportable object. |
public function setViewportView(view:Component):Void
Creates a JViewport and then sets its 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.
view | the component to add to the viewport |
public function getViewportView():Component
Returns the view currently in the scrollpane.
public function getVisibleRect():Rectangle
Returns the visible extent rectangle related the current scroll properties.
the visible extent rectangle
public function addAdjustmentListener(func:Function, obj:Object):Object
Shortcut to and ON_ADJUSTMENT_VALUE_CHANGED listener.
addAdjustmentListener(func:Function)
addAdjustmentListener(func:Function, obj:Object)
func | the function which want to handler the event. |
obj | context in which to run the function of param func. |
public function setHorizontalScrollBar(horizontalScrollBar:JScrollBar):Void
Adds the scrollbar that controls the viewport's horizontal view position to the scrollpane.
public function setVerticalScrollBar(verticalScrollBar:JScrollBar):Void
Adds the scrollbar that controls the viewport's vertical view position to the scrollpane.