oreilly java swing : JTable 之 JTableHeader

15.3.9 The JTableHeader Class

The JTableHeader class is an extension of JComponent and serves as the header component for tables. It not only dictates the basic color and font used for the header, but also the resizability and relocatability of the columns in the table. If you have an appropriate renderer for the header, you can also enable tooltips for the header. An example of custom renderers appears in Chapter 16.

15.3.9.1 Properties

The JTableHeader class has the properties listed in Table 15-14.

Table 15-14. JTableHeader properties

Property

Data type

get

is

set

Default value

accessibleContexto

AccessibleContext

·

  

JTableHeader.AccessibleJTableHeader( )

columnModel

TableColumnModel

·

 

·

DefaultColumnModel( )

draggedColumn

TableColumn

·

 

·

null

draggedDistance

int

·

 

·

0

opaqueo

boolean

 

·

·

true

reorderingAllowed

boolean

·

 

·

true

resizingAllowed

boolean

·

 

·

true

resizingColumn

TableColumn

·

 

·

null

table

JTable

·

 

·

null

UIb

TableHeaderUI

·

 

·

From L&F

UIClassIDo

String

·

  

"TableHeaderUI"

updateTableInRealTime

boolean

·

 

·

true

bbound, ooverridden

See also properties from the JComponent class (Table 3-6).

The columnModel property is the TableColumnModel in place for the header. This is normally set through the constructor during the JTable initializeLocalVars( ) call. The draggedColumn and resizingColumn properties return the TableColumn object that the user has moved or resized. You can control whether the user is allowed to move or resize columns using the reorderingAllowed and resizingAllowed properties. The updateTableInRealTime property dictates whether the column being moved or resized is visually updated during the move or after. If this property is false, only the column headers move until the action is complete, and then the table is updated. The table property represents the companion table for the header.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值