- Composite類
getChildren()
lists the children of a Composite as an array of Control objects.
getLayout()、setLayout(Layout)
處理layout對象
getTabList()、setTabList(Control[])
指定widgets在Composite中的Tab順序(按鍵盤tab鍵的切換順序)
Composite類是Scrollable類的直接子類,這就是說SWT/JFace中的所有Composite對象都有Scrollbars.所有的Scrollable對象都可使用如下方法:
getClientArea()、 computeTrim(int, int,int, int)
trim--Composite的不可編輯區域,如title bars, scrollbars, 或status bars等.
client area--那些可編輯,使用的區域
getClientArea()--Returns the available display area of a Scrollable object
computeTrim(int,int,int,int)--Returns the necessary dimensions of the Composite for the desired client area
getHorizontalBar()、getVerticalBar()
Returns the horizontal/vertical ScrollBar object
Control, Scrollable, and Composite的關系,如下圖??
- Groups
Composite子類中最簡單的一個,自身不執行任何動作,僅僅是將一組子widgets用矩形邊框起來,此邊框類似于之前提到的分隔符,同樣也提供SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE風格,還可以通過選擇SWT.SHADOW_ETCHED_IN or SWT.SHADOW_ETCHED_OUT來客制化陰影效果。
可以通過setText()方法來設定它的label
與許多Widgets子類一樣,Group類不可被繼承。
- SashForms
可以在子widgets之間創建可移動的分界,此分界稱為Sash.Sash類可以在org.eclipse.swt.widgets包中找到,而SashForms卻存在于org.eclipse.swt.custom包中。
SWT.HORIZONTAL和SWT.VERTICAL--用來設定Sash的方向
setOrientation()--用來設定Sash的方向
getMaximizedControl()--returns the Control object that has been expanded the most.
getWeights()--returns an int array containing the weight of each of the SashForm’s children.uses an int array to specify weights for each of the widgets in the Composite.
- TabFolders
creating and populating a TabFolder的四個步驟:
1.?創建一個TabFolder實例
2. 為每個頁面構建一個TabItem對象
3. 用setText()方法來設定tab的label
4. setControl()--關聯一個control,當它的tab被選中時,顯示此control
TabFolder類提供了一些用來獲得TabItems信息的方法,如下:
getItemCount()
返回此TabFolder所包含的TabItems數
getItems()
返回TabItems對象的數組
getSelection()
確定user選擇了哪個TabItem
setSelection()
Makes this decision from within the application