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

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

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

ScrollBar.setMaximum介绍

[英]Sets the maximum. If this value is negative or less than or equal to the minimum, the value is ignored. If necessary, first the thumb and then the selection are adjusted to fit within the new range.
[中]设置最大值。如果该值为负值或小于或等于最小值,则忽略该值。如有必要,首先调整拇指,然后调整选择以适应新范围。

代码示例

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

sbHorizontal.setVisible( true );
sbHorizontal.setMaximum( maxdrawn.width );
sbHorizontal.setMinimum( 0 );
sbHorizontal.setPageIncrement( size_widget.width );
sbVertical.setVisible( true );
sbVertical.setMaximum( maxdrawn.height );
sbVertical.setMinimum( 0 );
sbVertical.setPageIncrement( size_widget.height );

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.nebula.widgets.grid

/**
 * {@inheritDoc}
 */
public void setMaximum(int value)
{
  scrollBar.setMaximum(value);
}

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

ScrollBar createScrollBar (int type) {
  ScrollBar bar = new ScrollBar (this, type);
  if ((state & CANVAS) != 0) {
    bar.setMaximum (100);
    bar.setThumb (10);
  }
  return bar;
}

代码示例来源:origin: rinde/RinSim

void updateScrollbars(boolean adaptToScrollbar) {
 final Rectangle rect = image.getBounds();
 final Rectangle client = canvas.getClientArea();
 hBar.setMaximum(rect.width);
 vBar.setMaximum(rect.height);
 hBar.setThumb(Math.min(rect.width, client.width));
 vBar.setThumb(Math.min(rect.height, client.height));
 if (!adaptToScrollbar) {
  final org.eclipse.swt.graphics.Point center = getCenteredOrigin();
  hBar.setSelection(-center.x);
  vBar.setSelection(-center.y);
 }
}

代码示例来源: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/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.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: com.github.rinde/rinsim-problem

@Override
 public void paintControl(PaintEvent e) {
  timeline.update();
  e.gc.drawImage(timeline.contents, origin.x, origin.y);
  e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED));
  e.gc.drawLine(origin.x + (int) (currentTime / timeline.timePerPixel),
    0, origin.x + (int) (currentTime / timeline.timePerPixel),
    canvas.getClientArea().height);
  hBar.setMaximum(timeline.getWidth() == 0 ? 1 : timeline.getWidth() + 20);
  vBar.setMaximum(timeline.getHeight() + 5);
  hBar.setThumb(Math.min(timeline.getWidth() + 20,
    canvas.getClientArea().width));
  vBar.setThumb(Math.min(timeline.getHeight() + 5,
    canvas.getClientArea().height));
 }
});

代码示例来源: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: 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: com.github.rinde/rinsim-pdptw

e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED));
e.gc.drawLine(timeX, 0, timeX, canvas.get().getClientArea().height);
hBar.setMaximum(timeline.getWidth() == 0 ? 1 : timeline.getWidth()
 + H_THUMB_SIZE);
vBar.setMaximum(timeline.getHeight() + V_THUMB_SIZE);
hBar.setThumb(Math.min(timeline.getWidth() + H_THUMB_SIZE, canvas.get()
 .getClientArea().width));

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

int maximum = Math.max (1, itemsCount);	/* setting a value of 0 here is ignored */
if (maximum != vBar.getMaximum ()) {
  vBar.setMaximum (maximum);

代码示例来源: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.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.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.platform/org.eclipse.swt.gtk.linux.ppc

if (this.content != null) {
  if (vBar != null) {
    vBar.setMaximum (0);
    vBar.setThumb (0);
    vBar.setSelection(0);
    hBar.setMaximum (0);
    hBar.setThumb (0);
    hBar.setSelection(0);

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

相关文章