本文整理了Java中org.eclipse.swt.widgets.List.getItemHeight()
方法的一些代码示例,展示了List.getItemHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.getItemHeight()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名:getItemHeight
[英]Returns the height of the area which would be used to display one of the items in the list.
[中]返回用于显示列表中一个项的区域的高度。
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception org.eclipse.swt.SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's list.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget ();
return list.getItemHeight ();
}
/**
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void mouseMove(MouseEvent e){
int item_height = list.getItemHeight();
int y = e.y;
int item_index = y/item_height;
if ( list.getSelectionIndex() != item_index ){
list.setSelection( item_index );
}
}
});
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
boolean needsVScrollBar() {
int availableHeight = getClientArea().height;
int height = getItemCount() * getItemHeight();
return height > availableHeight;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
Point getItemDimensions() {
int width = 0;
int height = 0;
if( getItemCount() > 0 ) {
int availableWidth = getClientArea().width;
if( ( style & SWT.H_SCROLL ) == 0 && isMarkupEnabledFor( this ) ) {
width = availableWidth;
} else {
width = Math.max( getMaxItemWidth(), availableWidth );
}
height = getItemHeight();
}
return new Point( width, height );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
final int getVisibleItemCount() {
int clientHeight = getBounds().height;
if( ( style & SWT.H_SCROLL ) != 0 ) {
clientHeight -= getHorizontalBar().getSize().y;
}
int result = 0;
if( clientHeight >= 0 ) {
int itemHeight = getItemHeight();
result = clientHeight / itemHeight;
}
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public void reveal(Object element) {
Assert.isNotNull(element);
int index = getElementIndex(element);
if (index == -1) {
return;
}
// algorithm patterned after List.showSelection()
int count = list.getItemCount();
if (count == 0) {
return;
}
int height = list.getItemHeight();
Rectangle rect = list.getClientArea();
int topIndex = list.getTopIndex();
int visibleCount = Math.max(rect.height / height, 1);
int bottomIndex = Math.min(topIndex + visibleCount, count) - 1;
if ((topIndex <= index) && (index <= bottomIndex)) {
return;
}
int newTop = Math.min(Math.max(index - (visibleCount / 2), 0),
count - 1);
list.setTopIndex(newTop);
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks.ui
protected List createDropDownList(Composite parent)
{
// create the list
list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
// fill the list
populateList(list);
GridData data =
new GridData(
GridData.HORIZONTAL_ALIGN_FILL
| GridData.GRAB_HORIZONTAL
| GridData.VERTICAL_ALIGN_FILL
| GridData.GRAB_VERTICAL);
data.heightHint = list.getItemHeight() * LIST_ITEM_COUNT;
list.setLayoutData(data);
listCreated = true;
return list;
}
protected Text createDropDownDetails(Composite parent)
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
public void reveal(Object element) {
Assert.isNotNull(element);
int index = getElementIndex(element);
if (index == -1) {
return;
}
// algorithm patterned after List.showSelection()
int count = list.getItemCount();
if (count == 0) {
return;
}
int height = list.getItemHeight();
Rectangle rect = list.getClientArea();
int topIndex = list.getTopIndex();
int visibleCount = Math.max(rect.height / height, 1);
int bottomIndex = Math.min(topIndex + visibleCount, count) - 1;
if ((topIndex <= index) && (index <= bottomIndex)) {
return;
}
int newTop = Math.min(Math.max(index - (visibleCount / 2), 0),
count - 1);
list.setTopIndex(newTop);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public void reveal(Object element) {
Assert.isNotNull(element);
int index = getElementIndex(element);
if (index == -1) {
return;
}
// algorithm patterned after List.showSelection()
int count = list.getItemCount();
if (count == 0) {
return;
}
int height = list.getItemHeight();
Rectangle rect = list.getClientArea();
int topIndex = list.getTopIndex();
int visibleCount = Math.max(rect.height / height, 1);
int bottomIndex = Math.min(topIndex + visibleCount, count) - 1;
if ((topIndex <= index) && (index <= bottomIndex)) {
return;
}
int newTop = Math.min(Math.max(index - (visibleCount / 2), 0),
count - 1);
list.setTopIndex(newTop);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
data.heightHint = buildList.getItemHeight();
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
代码示例来源:origin: org.microemu/microemu-javase-swt
gridData.horizontalSpan = 3;
gridData.grabExcessVerticalSpace = true;
Rectangle trim = lsDevices.computeTrim(0, 0, 0, lsDevices.getItemHeight() * 5);
gridData.heightHint = trim.height;
lsDevices.setLayoutData(gridData);
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
int height = 0;
if (hHint == SWT.DEFAULT) {
int itemHeight = getItemHeight () + CELL_GAP;
height = itemCount * itemHeight;
} else {
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
| GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
| GridData.GRAB_VERTICAL);
data.heightHint = list.getItemHeight() * LIST_ITEM_COUNT;
data.horizontalSpan = 2;
list.setLayoutData(data);
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
public Point computeSize( int wHint, int hHint, boolean changed ) {
checkWidget ();
int width = getMaxItemWidth();
int height = getItemHeight() * getItemCount();
if( width == 0 ) {
width = DEFAULT_WIDTH;
}
if( height == 0 ) {
height = DEFAULT_HEIGHT;
}
if( wHint != SWT.DEFAULT ) {
width = wHint;
}
if( hHint != SWT.DEFAULT ) {
height = hHint;
}
BoxDimensions border = getBorder();
width += border.left + border.right;
height += border.top + border.bottom;
if( ( style & SWT.V_SCROLL ) != 0 ) {
width += getVerticalBar().getSize().x;
}
if( ( style & SWT.H_SCROLL ) != 0 ) {
height += getHorizontalBar().getSize().y;
}
return new Point( width, height );
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
int itemCount = list.getItemCount ();
itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
内容来源于网络,如有侵权,请联系作者删除!