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

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

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

ScrollBar.setSelection介绍

[英]Sets the single selection that is the receiver's value to the argument which must be greater than or equal to zero.
[中]

代码示例

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

sbHorizontal.setSelection( 0 );
 sbHorizontal.setVisible( false );
} else {
 sbVertical.setSelection( 0 );
 sbVertical.setVisible( false );
} else {

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

private static void setScrollBarSelection( ScrollBar scrollBar, int selection ) {
 if( scrollBar != null ) {
  scrollBar.setSelection( selection );
 }
}

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

private static void setScrollBarSelection( ScrollBar scrollBar, int selection ) {
 if( scrollBar != null ) {
  scrollBar.setSelection( selection );
 }
}

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

private static void setScrollBarSelection( ScrollBar scrollBar, int selection ) {
 if( scrollBar != null ) {
  scrollBar.setSelection( selection );
 }
}

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

void resetScrollBars() {
  if (image == null) return;
  ix = 0; iy = 0; py = 0;
  resizeScrollBars();
  imageCanvas.getHorizontalBar().setSelection(0);
  imageCanvas.getVerticalBar().setSelection(0);
  paletteCanvas.getVerticalBar().setSelection(0);
}

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

/**
   * {@inheritDoc}
   */
  public void setSelection(int selection)
  {
// RAP [if]: ScrollBar#setSelection() does not limit the value
//        scrollBar.setSelection(selection);
    int minimum = scrollBar.getMinimum();
    int maximum = scrollBar.getMaximum();
    int thumb = scrollBar.getThumb();
    if( selection < minimum ) {
     scrollBar.setSelection( minimum );
    } else if ( selection > maximum - thumb ) {
     scrollBar.setSelection( maximum - thumb );
    } else {
     scrollBar.setSelection( selection );
    }
  }

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

@Override
    public void runSupport() {
      if (isDisposed()) {
        return;
      }
      int pos = vBar.getSelection();
      if ( distance > 0 ){
        pos += distance;
        pos = Math.min( pos,vBar.getMaximum());
        vBar.setSelection( pos );
      }else{
        pos += distance;
        pos = Math.max( pos,vBar.getMinimum());
        vBar.setSelection( pos );
      }
      swt_vBarChanged();
    }});
}

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

/**
 * Set the origin of the view. NOTE: this won't be done immediately.
 * 
 * @param pt
 */
public void setOrigin(Point pt) {
  Point p = checkOrigin(pt);
  if (p.equals(_origin))
    return;
  getHorizontalBar().setSelection(p.x);
  getVerticalBar().setSelection(p.y);
  scrollTo(p);
}

代码示例来源: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: openaudible/openaudible

public void scrollToEnd() {
  SWTAsync.assertGUI();
  
  ScrollBar sb = consoleText.getVerticalBar();
  if (sb != null) {
    sb.setSelection(sb.getMaximum());
  }
}

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

public void setImage(Image img) {
  fImage= img;
  if (!isDisposed()) {
    getHorizontalBar().setSelection(0);
    getVerticalBar().setSelection(0);
    updateScrollbars();
    getParent().layout();
    redraw();
  }
}

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

public void setImage(Image img) {
  fImage= img;
  if (!isDisposed()) {
    getHorizontalBar().setSelection(0);
    getVerticalBar().setSelection(0);
    updateScrollbars();
    getParent().layout();
    redraw();
  }
}

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

private void syncViewport(MergeSourceViewer w) {
  
  if (fInScrolling)
    return;
  int ix= w.getTopIndex();
  int ix2= w.getDocumentRegionOffset();
  
  int viewPosition= realToVirtualPosition(w, ix-ix2);
      
  scrollVertical(viewPosition, viewPosition, viewPosition, w);    // scroll all but the given views
  
  if (fVScrollBar != null) {
    int value= Math.max(0, Math.min(viewPosition, getVirtualHeight() - getViewportHeight()));
    fVScrollBar.setSelection(value);
    //refreshBirdEyeView();
  }
}

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

@Override
  public void run() {
    if (styledText == null) return;
    int i;
    long start = System.currentTimeMillis();
    for (i = 0; i < lineCount; i++) {
      if (lineHeight[i] == -1 || lineWidth[i] == -1) {
        calculate(i, 1);
        if (System.currentTimeMillis() - start > IDLE_TIME) break;
      }
    }
    if (i < lineCount) {
      Display display = styledText.getDisplay();
      display.asyncExec(this);
    } else {
      idleRunning = false;
      styledText.setScrollBars(true);
      ScrollBar bar = styledText.getVerticalBar();
      if (bar != null) {
        bar.setSelection(styledText.getVerticalScrollOffset());
      }
    }
  }
};

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

@Override
  public void run() {
    if (styledText == null) return;
    int i;
    long start = System.currentTimeMillis();
    for (i = 0; i < lineCount; i++) {
      if (lineHeight[i] == -1 || lineWidth[i] == -1) {
        calculate(i, 1);
        if (System.currentTimeMillis() - start > IDLE_TIME) break;
      }
    }
    if (i < lineCount) {
      Display display = styledText.getDisplay();
      display.asyncExec(this);
    } else {
      idleRunning = false;
      styledText.setScrollBars(true);
      ScrollBar bar = styledText.getVerticalBar();
      if (bar != null) {
        bar.setSelection(styledText.getVerticalScrollOffset());
      }
    }
  }
};

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

private static void processScrollBarSelection( final ScrollBar scrollBar,
                        final int selection )
{
 if( scrollBar != null ) {
  scrollBar.setSelection( selection );
  if( SelectionEvent.hasListener( scrollBar ) ) {
   int eventId = SelectionEvent.WIDGET_SELECTED;
   SelectionEvent evt = new SelectionEvent( scrollBar, null, eventId );
   evt.stateMask
    = EventLCAUtil.readStateMask( JSConst.EVENT_WIDGET_SELECTED_MODIFIER );
   evt.processEvent();
  }
 }
}

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

private static void processScrollBarSelection( final ScrollBar scrollBar,
                        final int selection )
{
 if( scrollBar != null ) {
  scrollBar.setSelection( selection );
  if( SelectionEvent.hasListener( scrollBar ) ) {
   int eventId = SelectionEvent.WIDGET_SELECTED;
   SelectionEvent evt = new SelectionEvent( scrollBar, null, eventId );
   evt.stateMask
    = EventLCAUtil.readStateMask( JSConst.EVENT_WIDGET_SELECTED_MODIFIER );
   evt.processEvent();
  }
 }
}

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

private void syncViewport(MergeSourceViewer w) {
  if (fInScrolling)
    return;
  int ix= w.getSourceViewer().getTopIndex();
  int ix2= w.getDocumentRegionOffset();
  int viewPosition= realToVirtualPosition(getLeg(w), ix-ix2);
  scrollVertical(viewPosition, viewPosition, viewPosition, w);    // scroll all but the given views
  if (fVScrollBar != null) {
    int value= Math.max(0, Math.min(viewPosition, fMerger.getVirtualHeight() - getViewportHeight()));
    fVScrollBar.setSelection(value);
    //refreshBirdEyeView();
  }
}

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

/**
 * Restores the state of the filter actions
 * @param memento the memento
 */	
public void restoreState(IMemento memento) {
  fMemberFilterActionGroup.restoreState(memento);
  getControl().setRedraw(false);
  refresh();
  getControl().setRedraw(true);
  
  boolean showInherited= Boolean.valueOf(memento.getString(TAG_SHOWINHERITED)).booleanValue();
  showInheritedMethods(showInherited);
  
  boolean showDefiningTypes= Boolean.valueOf(memento.getString(TAG_SORTBYDEFININGTYPE)).booleanValue();
  sortByDefiningType(showDefiningTypes);
  
  ScrollBar bar= getTable().getVerticalBar();
  if (bar != null) {
    Integer vScroll= memento.getInteger(TAG_VERTICAL_SCROLL);
    if (vScroll != null) {
      bar.setSelection(vScroll.intValue());
    }
  }
}

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

/**
 * Restores the state of the filter actions
 * @param memento the memento
 */
public void restoreState(IMemento memento) {
  fMemberFilterActionGroup.restoreState(memento);
  getControl().setRedraw(false);
  refresh();
  getControl().setRedraw(true);
  boolean showInherited= Boolean.valueOf(memento.getString(TAG_SHOWINHERITED)).booleanValue();
  showInheritedMethods(showInherited);
  boolean showDefiningTypes= Boolean.valueOf(memento.getString(TAG_SORTBYDEFININGTYPE)).booleanValue();
  sortByDefiningType(showDefiningTypes);
  ScrollBar bar= getTable().getVerticalBar();
  if (bar != null) {
    Integer vScroll= memento.getInteger(TAG_VERTICAL_SCROLL);
    if (vScroll != null) {
      bar.setSelection(vScroll.intValue());
    }
  }
}

相关文章