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

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

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

ScrollBar.setPageIncrement介绍

[英]Sets the amount that the receiver's value will be modified by when the page increment/decrement areas are selected to the argument, which must be at least one.
[中]设置当为参数选择页面递增/递减区域时,接收器值将被修改的量,该值必须至少为一。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

sbHorizontal.setPageIncrement( size_widget.width );
sbHorizontal.setIncrement( 10 );
sbVertical.setPageIncrement( size_widget.height );
sbVertical.setIncrement( 10 );

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

public static void updatePageIncrement(ScrolledComposite scomp) {
  ScrollBar vbar = scomp.getVerticalBar();
  if (vbar != null) {
    Rectangle clientArea = scomp.getClientArea();
    int increment = clientArea.height - 5;
    vbar.setPageIncrement(increment);
  }
  ScrollBar hbar = scomp.getHorizontalBar();
  if (hbar != null) {
    Rectangle clientArea = scomp.getClientArea();
    int increment = clientArea.width - 5;
    hbar.setPageIncrement(increment);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

public static void updatePageIncrement(ScrolledComposite scomp) {
  ScrollBar vbar = scomp.getVerticalBar();
  if (vbar != null) {
    Rectangle clientArea = scomp.getClientArea();
    int increment = clientArea.height - 5;
    vbar.setPageIncrement(increment);
  }
  ScrollBar hbar = scomp.getHorizontalBar();
  if (hbar != null) {
    Rectangle clientArea = scomp.getClientArea();
    int increment = clientArea.width - 5;
    hbar.setPageIncrement(increment);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui

public void controlResized(ControlEvent e) {
    Rectangle clientArea = fScrolledComposite.getClientArea();
    
    ScrollBar verticalBar= fScrolledComposite.getVerticalBar();
    verticalBar.setIncrement(VERTICAL_SCROLL_INCREMENT);
    verticalBar.setPageIncrement(clientArea.height - verticalBar.getIncrement());
    ScrollBar horizontalBar= fScrolledComposite.getHorizontalBar();
    horizontalBar.setIncrement(HORIZONTAL_SCROLL_INCREMENT);
    horizontalBar.setPageIncrement(clientArea.width - horizontalBar.getIncrement());
  }
});

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

/**
 * Resizes the maximum and thumb of both scrollbars.
 */
void resizeScrollBars () {
  Rectangle clientArea = canvas.getClientArea();
  ScrollBar bar = canvas.getHorizontalBar();
  if (bar != null) {
    bar.setMaximum(maxX);
    bar.setThumb(clientArea.width);
    bar.setPageIncrement(clientArea.width);
  }
  bar = canvas.getVerticalBar();
  if (bar != null) {
    bar.setMaximum(maxY);
    bar.setThumb(clientArea.height);
    bar.setPageIncrement(clientArea.height);
  }
}

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

void updateHorizontalBar (int newRightX, int rightXchange) {
  if (drawCount > 0) return;
  ScrollBar hBar = getHorizontalBar ();
  if (hBar == null) return;

  newRightX += horizontalOffset;
  int barMaximum = hBar.getMaximum ();
  if (newRightX > barMaximum) {	/* item has extended beyond previous maximum */
    hBar.setMaximum (newRightX);
    int clientAreaWidth = clientArea.width;
    int thumb = Math.min (newRightX, clientAreaWidth);
    hBar.setThumb (thumb);
    hBar.setPageIncrement (thumb);
    hBar.setVisible (clientAreaWidth <= newRightX);
    return;
  }

  int previousRightX = newRightX - rightXchange;
  if (previousRightX != barMaximum) {
    /* this was not the rightmost item, so just check for client width change */
    int clientAreaWidth = clientArea.width;
    int thumb = Math.min (barMaximum, clientAreaWidth);
    hBar.setThumb (thumb);
    hBar.setPageIncrement (thumb);
    hBar.setVisible (clientAreaWidth <= barMaximum);
    return;
  }
  updateHorizontalBar ();        /* must search for the new rightmost item */
}
void updateVerticalBar () {

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

/**
 */
private void updateVScrollBar() {
  if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
    int virtualHeight= fMerger.getVirtualHeight();
    int viewPortHeight= getViewportHeight();
    int pageIncrement= viewPortHeight-1;
    int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
    fVScrollBar.setPageIncrement(pageIncrement);
    fVScrollBar.setMaximum(virtualHeight);
    fVScrollBar.setThumb(thumb);
  }
}

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

/**
 */
private void updateVScrollBar() {
  
  if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
    int virtualHeight= getVirtualHeight();
    int viewPortHeight= getViewportHeight();
    int pageIncrement= viewPortHeight-1;
    int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
          
    fVScrollBar.setPageIncrement(pageIncrement);
    fVScrollBar.setMaximum(virtualHeight);
    fVScrollBar.setThumb(thumb);
  }            
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.views.properties.tabbed

.getScrolledComposite().getClientArea();
int increment = clientArea.height - 5;
verticalScrollBar.setPageIncrement(increment);
    .getScrolledComposite().getClientArea();
int increment = clientArea.width - 5;
horizontalScrollBar.setPageIncrement(increment);

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

/**
 * Update the scrollbars
 * 
 * @return true if we need to relayout the whole thing
 */
protected boolean updateScrollBars() {
  Point size = getScreenSize();
  ScrollBar hBar = getHorizontalBar(), vBar = getVerticalBar();
  boolean needRelayout = false;
  hBar.setMaximum(_drawnSize.x);
  hBar.setThumb(Math.min(_drawnSize.x, size.x));
  hBar.setIncrement(15); // TODO something meaningful ?
  hBar.setPageIncrement(size.x);
  boolean visible = !(_origin.x == 0 && _drawnSize.x <= size.x);
  hBar.setVisible(visible);
  size = getScreenSize();
  vBar.setMaximum(_drawnSize.y);
  vBar.setThumb(Math.min(_drawnSize.y, size.y));
  vBar.setIncrement(15); // TODO line height here
  vBar.setPageIncrement(size.y);
  visible = !(_origin.y == 0 && _drawnSize.y <= size.y);
  if (!isPrint() && vBar.isVisible() != visible) {
    needRelayout = true;
  }
  vBar.setVisible(visible);
  return needRelayout;
}

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

private void setupSC(ScrolledComposite sc) {
  if (sc == null) {
    return;
  }
  Composite c = (Composite) sc.getContent();
  if (c != null) {
    Point size1 = c.computeSize(sc.getClientArea().width, SWT.DEFAULT);
    Point size = c.computeSize(SWT.DEFAULT, size1.y);
    sc.setMinSize(size);
  }
  ScrollBar verticalBar = sc.getVerticalBar();
  if (verticalBar != null) {
    verticalBar.setPageIncrement(sc.getSize().y);
  }
}

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

if (thumb != hBar.getThumb ()) {
  hBar.setThumb (thumb);
  hBar.setPageIncrement (thumb);

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

if (thumb != vBar.getThumb ()) {
  vBar.setThumb (thumb);
  vBar.setPageIncrement (thumb);

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

/**
 * @private
 */
void updateScrollbars() {
  Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
  Point size= getSize();
  Rectangle clientArea= getClientArea();
  ScrollBar horizontal= getHorizontalBar();
  if (bounds.width <= clientArea.width) {
    horizontal.setVisible(false);
    horizontal.setSelection(0);
  } else {
    horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
    int max= bounds.width + (size.x - clientArea.width);
    horizontal.setMaximum(max);
    horizontal.setThumb(size.x > max ? max : size.x);
    horizontal.setVisible(true);
  }
  ScrollBar vertical= getVerticalBar();
  if (bounds.height <= clientArea.height) {
    vertical.setVisible(false);
    vertical.setSelection(0);
  } else {
    vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
    int max= bounds.height + (size.y - clientArea.height);
    vertical.setMaximum(max);
    vertical.setThumb(size.y > max ? max : size.y);
    vertical.setVisible(true);
  }
}

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

/**
 * @private
 */
void updateScrollbars() {
  Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
  Point size= getSize();
  Rectangle clientArea= getClientArea();
  ScrollBar horizontal= getHorizontalBar();
  if (bounds.width <= clientArea.width) {
    horizontal.setVisible(false);
    horizontal.setSelection(0);
  } else {
    horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
    int max= bounds.width + (size.x - clientArea.width);
    horizontal.setMaximum(max);
    horizontal.setThumb(size.x > max ? max : size.x);
    horizontal.setVisible(true);
  }
  ScrollBar vertical= getVerticalBar();
  if (bounds.height <= clientArea.height) {
    vertical.setVisible(false);
    vertical.setSelection(0);
  } else {
    vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
    int max= bounds.height + (size.y - clientArea.height);
    vertical.setMaximum(max);
    vertical.setThumb(size.y > max ? max : size.y);
    vertical.setVisible(true);
  }
}

相关文章