本文整理汇总了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 );
}