本文整理匯總了Java中org.eclipse.swt.custom.CCombo.getSize方法的典型用法代碼示例。如果您正苦於以下問題:Java CCombo.getSize方法的具體用法?Java CCombo.getSize怎麽用?Java CCombo.getSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.getSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getInsertionBounds
import org.eclipse.swt.custom.CCombo; //導入方法依賴的package包/類
public Rectangle getInsertionBounds(Control control) {
// This doesn't take horizontal scrolling into affect.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599
CCombo combo = (CCombo) control;
int position = combo.getSelection().y;
String contents = combo.getText();
GC gc = new GC(combo);
gc.setFont(combo.getFont());
Point extent = gc.textExtent(contents.substring(0, Math.min(position,
contents.length())));
gc.dispose();
if (COMPUTE_TEXT_USING_CLIENTAREA) {
return new Rectangle(combo.getClientArea().x + extent.x, combo
.getClientArea().y, 1, combo.getClientArea().height);
}
return new Rectangle(extent.x, 0, 1, combo.getSize().y);
}
示例2: getInsertionBounds
import org.eclipse.swt.custom.CCombo; //導入方法依賴的package包/類
public Rectangle getInsertionBounds( Control control )
{
// This doesn't take horizontal scrolling into affect.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599
CCombo combo = (CCombo) control;
int position = combo.getSelection( ).y;
String contents = ChartUIUtil.getText( combo );
GC gc = new GC( combo );
gc.setFont( combo.getFont( ) );
Point extent = gc.textExtent( contents.substring( 0,
Math.min( position, contents.length( ) ) ) );
gc.dispose( );
if ( COMPUTE_TEXT_USING_CLIENTAREA )
{
return new Rectangle( combo.getClientArea( ).x + extent.x,
combo.getClientArea( ).y,
1,
combo.getClientArea( ).height );
}
return new Rectangle( extent.x, 0, 1, combo.getSize( ).y );
}