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

x33g5p2x  于2022-01-30 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(209)

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

ScrollBar.setValues介绍

[英]Sets the receiver's selection, minimum value, maximum value, thumb, increment and page increment all at once.

Note: This is similar to setting the values individually using the appropriate methods, but may be implemented in a more efficient fashion on some platforms.
[中]同时设置接收器的选择、最小值、最大值、拇指、增量和页面增量。
注意:这类似于使用适当的方法单独设置值,但在某些平台上可能会以更高效的方式实现。

代码示例

代码示例来源:origin: com.diffplug.durian/durian-swt

private void readjustScrollBar() {
  int increment = height;
  int pageIncrement = height;
  int thumb = height;
  int selection = round(topRow * rowHeight);
  int minimum = 0;
  int maximum = itemCount * rowHeight;
  minTopPixel = 0;
  maxTopPixel = maximum - height;
  if (selection < 0) {
    // we've scrolled into the negatives
    minTopPixel = selection;
    if (maximum < height) {
      maximum = height - selection;
    } else {
      maximum -= selection;
    }
    selection = 0;
  } else if (maximum < height) {
    // we've scrolled lower than is now possible
    maximum = height + selection;
    maxTopPixel = selection;
  }
  maxTopPixel = Math.max(0, maxTopPixel);
  if (hasVScroll) {
    getVerticalBar().setValues(selection, minimum, maximum, thumb, increment, pageIncrement);
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void setScrollbar () {
  if (itemCount == 0) return;
  ScrollBar verticalBar = getVerticalBar ();
  if (verticalBar == null) return;
  int height = getClientArea ().height;
  ExpandItem item = items [itemCount - 1];
  int maxHeight = item.y + getBandHeight () + spacing;
  if (item.expanded) maxHeight += item.height;

  //claim bottom free space
  if (yCurrentScroll > 0 && height > maxHeight) {
    yCurrentScroll = Math.max (0, yCurrentScroll + maxHeight - height);
    layoutItems (0, false);
  }
  maxHeight += yCurrentScroll;
  
  int selection = Math.min (yCurrentScroll, maxHeight);
  int increment = verticalBar.getIncrement ();
  int pageIncrement = verticalBar.getPageIncrement ();
  verticalBar.setValues(selection, 0, maxHeight, height, increment, pageIncrement);
  verticalBar.setVisible(maxHeight > height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

} else {
  horizontal.setEnabled(true);
  horizontal.setValues(displayFDC.xOffset, 0, imageWidth, visibleWidth,
    8, visibleWidth);
} else {
  vertical.setEnabled(true);
  vertical.setValues(displayFDC.yOffset, 0, imageHeight, visibleHeight,
    8, visibleHeight);

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

bottomOffset= bottomOffset - originalSize.y + fakeHeight;
textWidget.setSize(originalSize.x + 100, fakeHeight);
verticalBar.setValues(0, 0, 1 << 30, 1, 10, 10);
arrowHeights= computeScrollArrowHeights(textWidget, bottomOffset);
fScrollArrowHeights= arrowHeights;

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

bottomOffset= bottomOffset - originalSize.y + fakeHeight;
textWidget.setSize(originalSize.x + 100, fakeHeight);
verticalBar.setValues(0, 0, 1 << 30, 1, 10, 10);
arrowHeights= computeScrollArrowHeights(textWidget, bottomOffset);
fScrollArrowHeights= arrowHeights;

代码示例来源:origin: BiglySoftware/BiglyBT

hBar.setValues(0, 0, 0, 10, 10, 100);
hBar.addSelectionListener(new SelectionListener() {
vBar.setValues(0, 0, 0, 50, getRowDefaultHeight(), 50);
vBar.addSelectionListener(new SelectionListener() {
  @Override

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

hBar.setValues (0, 0, 1, 1, 1, 1);
hBar.setVisible (false);
hBar.addListener (SWT.Selection, listener);
vBar.setValues (0, 0, 1, 1, 1, 1);
vBar.setVisible (false);
vBar.addListener (SWT.Selection, listener);

代码示例来源:origin: BiglySoftware/BiglyBT

hBar.setEnabled(true);
hBar.setValues(hBar.getSelection(), 0, max, tableSize, 50, tableSize);

相关文章