org.eclipse.swt.widgets.List.getClientArea()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.eclipse.swt.widgets.List.getClientArea()方法的一些代码示例,展示了List.getClientArea()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.getClientArea()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名:getClientArea

List.getClientArea介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

boolean needsHScrollBar() {
 boolean result = false;
 if( ( style & SWT.H_SCROLL ) != 0 ) {
  int availableWidth = getClientArea().width;
  int width = getMaxItemWidth();
  result = width > availableWidth;
 }
 return result;
}

代码示例来源: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.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.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);
}

相关文章

微信公众号

最新文章

更多

List类方法