Viewportable
A JTextArea is a multi-line area that displays text.
With JScrollPane, it's easy to be a scrollable text area, for example:
var ta:JTextArea = new JTextArea(); var sp:JScrollPane = new JScrollPane(ta); //or //var sp:JScrollPane = new JScrollPane(); //sp.setView(ta);
new JTextArea()
public function JTextArea(text:String, rows:Number, columns:Number)
JTextArea(text:String, rows:Number, columns:Number)
JTextArea(text:String, rows:Number) columns default to 0
JTextArea(text:String) rows and columns default to 0
JTextArea() text default to 0, rows and columns default to 0
static public ON_STATE_CHANGED:String
public function updateUI():Void
Description copied from JTextComponent
Resets the UI property to a value from the current look
and feel. Subtypes of JTextComponent
should override this to update the UI. For
example, JTextField
might do the following:
setUI(TextUI(UIManager.getUI(this)));
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 isWordWrap():Boolean
Description copied from JTextComponent
Subclass override this to change Text's wordWrap ability
public function setColumns(columns:Number):Void
Sets the number of columns in this JTextArea, if it changed then call parent to do layout.
columns | the number of columns to use to calculate the preferred width; if columns is set to zero or min than zero, the preferred width will be matched just to view all of the text. default value is zero if missed this param. |
public function setRows(rows:Number):Void
Sets the number of rows in this JTextArea, if it changed then call parent to do layout.
rows | the number of rows to use to calculate the preferred width; if columns is set to zero or min than zero, the preferred width will be matched just to view all of the text. default value is zero if missed this param. |
public function setMultiline(b:Boolean):Void
Sets if the text is multiline, by default it is true.
b | true to support multiline, otherwise false. |
public function addChangeListener(func:Function, obj:Object):Object
the Viewportable
state change listener adding method implementation.
public function getVerticalUnitIncrement():Number
Returns the unit value for the Vertical scrolling.
public function getVerticalBlockIncrement():Number
Return the block value for the Vertical scrolling.
public function getHorizontalUnitIncrement():Number
Returns the unit value for the Horizontal scrolling.
public function getHorizontalBlockIncrement():Number
Return the block value for the Horizontal scrolling.
public function setViewportTestSize(s:Dimension):Void
Description copied from Viewportable
Before JScrollPane analyse the scroll properties(call getExtentSize and getViewSize), it will call this method to set the size of viewport will be to test.
public function getExtentSize():Dimension
Returns the size of the visible part of the view in view logic coordinates.
a Dimension
object giving the size of the view
public function getViewSize():Dimension
Returns the viewportable view's amount size if view all content in view logic coordinates.
the view's size.
public function getViewPosition():Point
Returns the view coordinates that appear in the upper left hand corner of the viewport, or 0,0 if there's no view. in view logic coordinates.
a Point
object giving the upper left coordinates
public function setViewPosition(p:Point):Void
Sets the view coordinates that appear in the upper left hand corner of the viewport. in view logic coordinates.
p | a Point object giving the upper left coordinates
|
public function getVisibleRows():Number
Returns visible row count.
how many rows can see
public function scrollRectToVisible(contentRect:Rectangle):Void
Scrolls the view so that Rectangle
within the view becomes visible. in view logic coordinates.
Note that this method will not scroll outside of the
valid viewport; for example, if contentRect
is larger
than the viewport, scrolling will be confined to the viewport's
bounds.
contentRect | the Rectangle to display
|
public function scrollToBottomLeft():Void
Scrolls to view bottom left content.
This will make the scrollbars of JScrollPane
scrolled automatically,
if it is located in a JScrollPane
.
public function scrollToBottomRight():Void
Scrolls to view bottom right content.
This will make the scrollbars of JScrollPane
scrolled automatically,
if it is located in a JScrollPane
.
public function scrollToTopLeft():Void
Scrolls to view top left content.
This will make the scrollbars of JScrollPane
scrolled automatically,
if it is located in a JScrollPane
.
public function scrollToTopRight():Void
Scrolls to view to right content.
This will make the scrollbars of JScrollPane
scrolled automatically,
if it is located in a JScrollPane
.
public function getViewportPane():Component
Return the component of the viewportable's pane which would added to displayed on the stage.
the component of the viewportable pane.