- Composite類
getChildren()
lists the children of a Composite as an array of Control objects.
getLayout()、setLayout(Layout)
處理layout對(duì)象
getTabList()、setTabList(Control[])
指定widgets在Composite中的Tab順序(按鍵盤tab鍵的切換順序)
Composite類是Scrollable類的直接子類,這就是說SWT/JFace中的所有Composite對(duì)象都有Scrollbars.所有的Scrollable對(duì)象都可使用如下方法:
getClientArea()、 computeTrim(int, int,int, int)
trim--Composite的不可編輯區(qū)域,如title bars, scrollbars, 或status bars等.
client area--那些可編輯,使用的區(qū)域
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的關(guān)系,如下圖??
- Groups
Composite子類中最簡(jiǎn)單的一個(gè),自身不執(zhí)行任何動(dòng)作,僅僅是將一組子widgets用矩形邊框起來,此邊框類似于之前提到的分隔符,同樣也提供SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE風(fēng)格,還可以通過選擇SWT.SHADOW_ETCHED_IN or SWT.SHADOW_ETCHED_OUT來客制化陰影效果。
可以通過setText()方法來設(shè)定它的label
與許多Widgets子類一樣,Group類不可被繼承。
- SashForms
可以在子widgets之間創(chuàng)建可移動(dòng)的分界,此分界稱為Sash.Sash類可以在org.eclipse.swt.widgets包中找到,而SashForms卻存在于org.eclipse.swt.custom包中。
SWT.HORIZONTAL和SWT.VERTICAL--用來設(shè)定Sash的方向
setOrientation()--用來設(shè)定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的四個(gè)步驟:
1.?創(chuàng)建一個(gè)TabFolder實(shí)例
2. 為每個(gè)頁面構(gòu)建一個(gè)TabItem對(duì)象
3. 用setText()方法來設(shè)定tab的label
4. setControl()--關(guān)聯(lián)一個(gè)control,當(dāng)它的tab被選中時(shí),顯示此control
TabFolder類提供了一些用來獲得TabItems信息的方法,如下:
getItemCount()
返回此TabFolder所包含的TabItems數(shù)
getItems()
返回TabItems對(duì)象的數(shù)組
getSelection()
確定user選擇了哪個(gè)TabItem
setSelection()
Makes this decision from within the application