Packageorg.aswing
Classpublic class JTable
InheritanceJTable Inheritance Container Inheritance Component Inheritance AWSprite Inheritance flash.display.Sprite
ImplementsCellEditorListener, LayoutManager, TableColumnModelListener, TableModelListener, Viewportable

The JTable is used to display and edit regular two-dimensional tables of cells.

The JTable has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily. For example, to set up a table with 10 rows and 10 columns of numbers:

      class MyTableModel extends AbstractTableModel{
          public function getColumnCount():int { return 10; }
          public function getRowCount():int { return 10;}
          public getValueAt(row:int, col:int) { return rowol; }
      };
      var dataModel:MyTableModel = new MyTableModel();
      var table:JTable = new JTable(dataModel);
      var scrollpane:JScrollPane = new JScrollPane(table);
 

Note that if you wish to use a JTable in a standalone view (outside of a JScrollPane) and want the header displayed, you can get it using {



Public Properties
 PropertyDefined by
 InheritedcacheAsBitmap : Boolean
AWSprite
 Inheritedcontainer : Container
Component
 Inheritedfilters : Array
AWSprite
 Inheritedheight : Number
Component
 Inheritedmask : DisplayObject
AWSprite
 InheritednumChildren : int
AWSprite
 Inheritedvisible : Boolean
Component
 Inheritedwidth : Number
Component
 Inheritedx : Number
Component
 Inheritedy : Number
Component
Protected Properties
 PropertyDefined by
 Inheritedbounds : IntRectangle
Component
  cellPane : Container
JTable
 Inheritedchildren : Array
Container
 Inheritedd_numChildren : int
AWSprite
 InheriteddrawTransparentTrigger : Boolean = true
Component
 Inheritedd_visible : Boolean
Returns the DisplayObject.visible directly.
Component
 Inheritedd_x : Number
Returns DisplayObject.x directly.
Component
 Inheritedd_y : Number
Returns DisplayObject.y directly.
Component
  headerPane : Container
JTable
 Inheritedlayout : LayoutManager
Container
 InheritedreadyToPaint : Boolean
Component
 Inheritedui : ComponentUI
Component
 Inheritedvalid : Boolean
Component
Public Methods
 MethodDefined by
  
JTable(dm:TableModel = null)
Constructs a default JTable.
JTable
  
Invoked when the row selection changes -- repaints to show the new selection.
JTable
 Inherited
addChild(dis:DisplayObject):DisplayObject
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
AWSprite
 Inherited
addChildAt(child:DisplayObject, index:int):DisplayObject
AWSprite
  
addColumn(aColumn:TableColumn):void
Appends aColumn to the end of the array of columns held by this JTable's column model.
JTable
  
addColumnSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Adds the columns from index0 to index1, inclusive, to the current selection.
JTable
  
addColumnSelectionListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a listener to column selection changed.
JTable
 Inherited
Adds a component to be the acceptable drag initiator to this component.
Component
  
addLayoutComponent(comp:Component, constraints:Object):void
do nothing
JTable
  
addRowSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Adds the rows from index0 to index1, inclusive, to the current selection.
JTable
  
addSelectionListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a listener to row selection changed.
JTable
  
addStateListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a listener to listen the viewpoat state change event.
JTable
 Inherited
append(com:Component, constraints:Object = null):void
On Component just can add to one Container.
Container
 Inherited
appendAll(... coms):void
Adds one or more component to the container with null constraints
Container
 Inherited
bringToBottom(child:DisplayObject):void
Brings a child to bottom.
AWSprite
 Inherited
bringToTop(child:DisplayObject):void
Brings a child to top.
AWSprite
  
changeSelection(rowIndex:int, columnIndex:int, toggle:Boolean, extend:Boolean, programmatic:Boolean = true):void
Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
JTable
  
clearSelection(programmatic:Boolean = true):void
Deselects all selected columns and rows.
JTable
  
Invoked when a column is added to the table column model.
JTable
  
Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount()-1].
JTable
  
Invoked when a column is moved due to a margin change.
JTable
  
Invoked when a column is repositioned.
JTable
  
Invoked when a column is removed from the table column model.
JTable
  
columnSelectionChanged(source:TableColumnModel, firstIndex:int, lastIndex:int, programmatic:Boolean):void
Invoked when the selection model of the TableColumnModel is changed.
JTable
 Inherited
Component
 Inherited
containsChild(child:DisplayObject):Boolean
Returns whether child is directly child of this sprite, true only if getChildIndex(child) >= 0.
AWSprite
  
convertColumnIndexToModel(viewColumnIndex:int):int
Maps the index of the column in the view at viewColumnIndex to the index of the column in the table model.
JTable
  
convertColumnIndexToView(modelColumnIndex:int):int
Maps the index of the column in the table model at modelColumnIndex to the index of the column in the view.
JTable
  
JTable
  
JTable
  
Creates default columns for the table from the data model using the getColumnCount method defined in the TableModel interface.
JTable
  
JTable
  
JTable
  
JTable
  
JTable
  
doLayout():void
Causes this table to lay out its rows and columns.
JTable
  
editCellAt(row:int, column:int, clickCount:int = -1):Boolean
editCellAt(row:int, column:int, clickCount:int):Boolean
editCellAt(row:int, column:int):Boolean

Programmatically starts editing the cell at row and column, if those indices are in the valid range, and the cell at those indices is editable.

JTable
  
Invoked when editing is canceled.
JTable
  
Invoked when editing is finished.
JTable
  
ensureCellIsVisible(row:int, column:int):void
Scrolls the JTable to make the specified cell completely visible.
JTable
 Inherited
fireFocusKeyDownEvent(e:KeyboardEvent):void
Component
 Inherited
fireFocusKeyUpEvent(e:KeyboardEvent):void
Component
 Inherited
getAlignmentX():Number
Returns the alignment along the x axis.
Component
 Inherited
getAlignmentY():Number
Returns the alignment along the y axis.
Component
 Inherited
getAlpha():Number
Returns the alpha of this component.
Component
  
Determines whether the table will create default columns from the model.
JTable
  
Returns the auto resize mode of the table.
JTable
 Inherited
getAwmlID():String
Returns ID used to identify components created from AWML.
Component
 Inherited
getAwmlIndex():Number
Returns position index of the component inside its AWML container.
Component
 Inherited
Returns namespace name used to identify components created from AWML.
Component
 Inherited
Gets the background color of this component.
Component
 Inherited
Returns the background decorator of this component.
Component
 Inherited
Returns the border.
Component
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
Same to DisplayObject.getBounds(), just add a explaination here that if you want to get the component bounds, see {
Component
  
JTable
  
JTable
  
getCellFactory(row:int, column:int):TableCellFactory
JTable
  
Returns the container that holds the cells.
JTable
  
getCellRect(row:int, column:int, includeSpacing:Boolean):IntRectangle
Returns a rectangle for the cell that lies at the intersection of row and column.
JTable
  
Returns true if both row and column selection models are enabled.
JTable
 Inherited
getChildAt(index:int):DisplayObject
AWSprite
 Inherited
getChildByName(name:String):DisplayObject
AWSprite
 Inherited
getChildIndex(child:DisplayObject):int
AWSprite
 Inherited
Returns the value of the property with the specified key.
Component
 Inherited
Returns the clip bounds.
Component
  
getColumn(identifier:Object):TableColumn
Returns the TableColumn object for the column in the table whose identifier is equal to identifier, when compared using equals.
JTable
  
getColumnAt(columnIndex:int):TableColumn
Returns the TableColumn object for the column at columnIndex.
JTable
  
getColumnClass(column:int):String
Returns the type of the column appearing in the view at column position column.
JTable
  
Returns the number of columns in the column model.
JTable
  
Returns the TableColumnModel that contains all column information of this table.
JTable
  
getColumnName(column:int):String
Returns the name of the column appearing in the view at column position column.
JTable
  
Returns true if columns can be selected.
JTable
 Inherited

Stores the bounds value of this component into "return value" rv and returns rv.

Component
 Inherited
getComponent(index:int):Component
Gets the nth(index) component in this container.
Container
 Inherited
Gets the number of components in this container.
Container
 Inherited
getConstraints():Object
Gets cpmponent's constraints.
Component
  
JTable
  
Returns the cell factory to be used when no factory has been set in a TableColumn.
JTable
  
getDefaultEditor(columnClass:String):TableCellEditor
Returns the editor to be used when no editor has been set in a TableColumn.
JTable
  
Returns the index of the column that contains the cell currently being edited.
JTable
  
Returns the index of the row that contains the cell currently being edited.
JTable
  
JTable
 Inherited
Returns the focus manager for this component's stage, or null if this component is not on stage.
Component
 Inherited
Returns the focus traversal policy of this container, it will return its parent's focus traversal policy if its self is null.
Container
 Inherited
Gets the font of this component.
Component
 Inherited
Gets the foreground color of this component.
Component
 Inherited
Returns the foreground decorator of this component.
Component
 Inherited
Stores the global location value of this component into "return value" p and returns p.
Component
  
Returns the color used to draw grid lines.
JTable
  
Returns the header height.
JTable
 Inherited
getHeight():int
Returns the current height of this component
Component
 Inherited
Returns the current top index for a new child(none forground child).
AWSprite
  
JTable
  
JTable
 Inherited
Returns the index of the child component in this container.
Container
 Inherited
If a border has been set on this component, returns the border's insets; otherwise returns an empty insets.
Component
  
Returns the horizontal and vertical space between cells.
JTable
 Inherited
getInternalFocusObject():InteractiveObject
Returns the object to receive the focus for this component.
Component
 Inherited
Returns the keyboard manager of this component's JRootPane ancestor.
Component
 Inherited
Container
  
return 0
JTable
  
return 0
JTable
 Inherited
Stores the location value of this component into "return value" rv and returns rv.
Component
  
Returns the location in the JTable view area of the logic location.
JTable
 Inherited
Returns the current bottom index for none background child.
AWSprite
 Inherited
Returns getMaximumSize().height
Component
 Inherited
Component
 Inherited
Returns getMaximumSize().width
Component
 Inherited
Returns getMinimumSize().height
Component
 Inherited
Component
 Inherited
Returns getMinimumSize().width
Component
  
Returns the TableModel that provides the data displayed by this JTable.
JTable
 Inherited
Returns the coordinate of the mouse position, in pixels, in the component scope.
Component
 Inherited
getName():String
Returns the name of the component
Component
 Inherited
Returns the bounds that component should paint in.
Component
 Inherited
Returns the Container parent, if it parent is not a Container, null will be returned.
Component
  
Returns the location in the JTable view area of the logic location.
JTable
 Inherited
Returns getPreferredSize().height
Component
  
Returns the preferred size of the viewport for this table.
JTable
 Inherited
Component
 Inherited
Returns getPreferredSize().width
Component
 Inherited
Returns the first JRootPane ancestor of this component.
Component
  
Returns the number of rows in this table's model.
JTable
  
Returns the height of a table row, in pixels.
JTable
  
Gets the amount of empty space, in pixels, between cells.
JTable
  
Returns true if rows can be selected.
JTable
  
Returns the index of the first selected column, -1 if no column is selected.
JTable
  
Returns the number of selected columns.
JTable
  
Returns the indices of all selected columns.
JTable
  
Returns the index of the first selected row, -1 if no row is selected.
JTable
  
Returns the number of selected rows.
JTable
  
Returns the indices of all selected rows.
JTable
  
Returns the background color for selected cells.
JTable
  
Returns the foreground color for selected cells.
JTable
  
Returns the ListSelectionModel that is used to maintain row selection state.
JTable
  
Returns true if the table draws horizontal lines between cells, false if it doesn't.
JTable
  
Returns true if the table draws vertical lines between cells, false if it doesn't.
JTable
 Inherited
Stores the size value of this component into "return value" rv and returns rv.
Component
  
Returns the tableHeader used by this JTable.
JTable
  
JTable
 Inherited
getToolTipText():String
Returns the tooltip string that has been set with setToolTipText.
Component
 Inherited
Component
  
getUIClassID():String
Returns the suffix used to construct the name of the L&F class used to render this component.
JTable
  
getValueAt(row:int, column:int):Object
Returns the cell value at row and column.
JTable
  
JTable
  
JTable
  
JTable
  
JTable
  
JTable
 Inherited
getWidth():int
Returns the current width of this component
Component
 Inherited
getX():int
Returns the current x coordinate of the components.
Component
 Inherited
getY():int
Returns the current y coordinate of the components.
Component
 Inherited
Component
 Inherited
hitTestMouse():Boolean
Returns whether the component hit the mouse.
Component
 Inherited
hitTestObject(obj:DisplayObject):Boolean
AWSprite
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
AWSprite
 Inherited
insert(i:int, com:Component, constraints:Object = null):void
Add component to spesified index.
Container
 Inherited
insertAll(index:int, ... coms):void
Insets one or more component to the container with null constraints at specified starting index.
Container
 Inherited
invalidate():void
Invalidates the container.
Container
  
JTable
 Inherited
Clears this component and all parents above it's preferred size caches.
Component
 Inherited
Checks if the component is contained in the component hierarchy of this container.
Container
 Inherited
Returns whether or not the preferred size, minimum size and max size cache is turned on.
Component
  
isCellEditable(row:int, column:int):Boolean
Returns true if the cell at row and column is editable.
JTable
  
isCellSelected(row:int, column:int):Boolean
Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.
JTable
 Inherited
isClipMasked():Boolean
Returns whether the component clip should be masked by its bounds.
AWSprite
  
isColumnSelected(column:int):Boolean
Returns true if the specified index is in the valid range of columns, and the column at that index is selected.
JTable
 Inherited
Returns whether the component is acceptable drag initiator for this component.
Component
 Inherited
isDragEnabled():Boolean
Returns whether this component can fire ON_DRAG_RECOGNIZED event.
Component
 Inherited
isDropTrigger():Boolean
Returns whether this component can trigger dragging component to fire drag events when dragging over to this component.(Default value is false)
Component
  
isEditing():Boolean
Returns true if a cell is being edited.
JTable
 Inherited
isEnabled():Boolean
Returns whether the component is enabled.
Component
 Inherited
isFocusable():Boolean
Returns whether this Component can be focused.
Component
 Inherited
isFocusableSet():Boolean
Returns whether or not the opaque property is set by user.
Component
 Inherited
isFocusOwner():Boolean
Returns true if this Component is the focus owner.
Component
 Inherited
isFontValidated():Boolean
Returns whether the new font are applied and taked effect.
Component
 Inherited
isOnStage():Boolean
Determines whether or not this component is on stage(on the display list).
Component
 Inherited
isOpaque():Boolean
Returns true if this component is completely opaque.
Component
 Inherited
isOpaqueSet():Boolean
Returns whether or not the opaque property is set by user.
Component
  
isRowSelected(row:int):Boolean
Returns true if the specified index is in the valid range of rows, and the row at that index is selected.
JTable
 Inherited
isShowing():Boolean
Determines whether this component is showing on screen.
Component
 Inherited
isUIElement():Boolean
Returns true if this component is just a ui element component, false means this component is a regular use created component.
Component
 Inherited
isValid():Boolean
Determines whether this component is valid.
Component
 Inherited
isValidateRoot():Boolean
If this method returns true, revalidate calls by descendants of this component will cause the entire tree beginning with this root to be validated.
Component
 Inherited
isVisible():Boolean
Component
  
position and fill cells here
JTable
 Inherited
makeFocus():void
Makes this component's internal focus object to be the stage focus directly, without any judgement.
Component
  
JTable
  
JTable
  
moveColumn(column:int, targetColumn:int):void
Moves the column column to the position currently occupied by the column targetColumn in the view.
JTable
 Inherited
pack():void
Causes this component to be sized to fit the preferred size.
Component
 Inherited
paintFocusRect(force:Boolean = false):void
Paints the focus rect if need.
Component
 Inherited
Redraw the component UI face immediately if it is visible and ready to paint.
Component
 Inherited
Calls parent reAppendChildren if parent is a container.
Component
  
JTable
 Inherited
putClientProperty(key:*, value:*):void
Adds an arbitrary key/value "client property" to this component.
Component
 Inherited
Removes all children and then append them with their constraints.
Container
 Inherited
reAppendToParent(constraints:Object = null):void
Removes this component from its parent and then append it with specified constraints.
Component
 Inherited
Remove the specified child component.
Container
 Inherited
removeAll():void
Remove all child components.
Container
 Inherited
Remove the specified index child component.
Container
 Inherited
removeChild(child:DisplayObject):DisplayObject
Removes a normal display object child.
Container
 Inherited
removeChildAt(index:int):DisplayObject
Removes a normal display object child with index.
Container
&nb