2012-02-17 121 views

回答

0

不,你不能做到這一點。至少沒有任何暴露的API(閱讀public methods)。 可能的解決方案是擴展代碼CTabFolderCTabItem

+0

到目前爲止,太8 / – 2012-03-20 17:36:56

1

你可以試着重寫CTabItem,但這種解決方案並不看起來很好的解決方案(不過我用它):這就是我發現

CTabItem tabItem; 

final int tabWidth = 90; 

tabItem = new CTabItem(tabFolder, SWT.NONE) { 
    @Override 
    public Rectangle getBounds() { 
     Rectangle bounds = super.getBounds(); 
     bounds.x = 0 * tabWidth; 
     bounds.width = tabWidth; 
     return bounds; 
    } 
}; 
tabItem.setText(__lang.str(this, "Tab Item I")); 

tabItem = new CTabItem(tabFolder, SWT.NONE) { 
    @Override 
    public Rectangle getBounds() { 
     Rectangle bounds = super.getBounds(); 
     bounds.x = 1 * tabWidth; 
     bounds.width = tabWidth; 
     return bounds; 
    } 
}; 
tabItem.setText(__lang.str(this, "Tab Item II")); 

tabItem = new CTabItem(tabFolder, SWT.NONE) { 
    @Override 
    public Rectangle getBounds() { 
     Rectangle bounds = super.getBounds(); 
     bounds.x = 2 * tabWidth; 
     bounds.width = tabWidth; 
     return bounds; 
    } 
}; 
tabItem.setText(__lang.str(this, "Tab Item III"));