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

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

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

ScrollBar.addSelectionListener介绍

[英]Adds the listener to the collection of listeners who will be notified when the user changes the receiver's value, by sending it one of the messages defined in the SelectionListener interface.

When widgetSelected is called, the event object detail field contains one of the following values: SWT.NONE - for the end of a drag. SWT.DRAG. SWT.HOME. SWT.END. SWT.ARROW_DOWN. SWT.ARROW_UP. SWT.PAGE_DOWN. SWT.PAGE_UP. widgetDefaultSelected is not called.
[中]将侦听器添加到侦听器集合中,当用户更改接收方的值时,将通过向其发送SelectionListener界面中定义的消息之一来通知这些侦听器。
调用widgetSelected时,事件对象详细信息字段包含以下值之一:[$2$]-用于拖动结束。SWT.DRAG. SWT.HOME. SWT.END. SWT.ARROW_DOWN. SWT.ARROW_UP. SWT.PAGE_DOWN. SWT.PAGE_UP. 未调用widgetDefaultSelected

代码示例

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

hori.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();
vert.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();

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

hori.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();
vert.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();

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

vert = canvas.getVerticalBar();
hori.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();
vert.addSelectionListener( new SelectionAdapter() {
 public void widgetSelected( SelectionEvent e ) {
  redraw();

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

sbVertical.addSelectionListener( new SelectionAdapter() {
 @Override
 public void widgetSelected( SelectionEvent e ) {
sbHorizontal.addSelectionListener( new SelectionAdapter() {
 @Override
 public void widgetSelected( SelectionEvent e ) {

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

vert = canvas.getVerticalBar();
hori.addSelectionListener( new SelectionAdapter() {
 @Override
 public void widgetSelected( SelectionEvent e ) {
vert.addSelectionListener( new SelectionAdapter() {
 @Override
 public void widgetSelected( SelectionEvent e ) {

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

/**
 * {@inheritDoc}
 */
public void addSelectionListener(SelectionListener listener)
{
  scrollBar.addSelectionListener(listener);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

public void install(AbstractThemedScrollBarAdapter abstractThemedScrollBarAdapter) {
  if (this.fScrollBar != null) {
    fScrollBar.setVisible(false);
    this.fScrollBar.addSelectionListener(abstractThemedScrollBarAdapter);
  }
}

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

private void initScrollBarListener() {
  ScrollBar scroll = getTable().getVerticalBar();
  fScrollSelectionListener = new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      handleScrollBarSelection();
    }
  };
  scroll.addSelectionListener(fScrollSelectionListener);
}

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

/**
 * Initializes all listeners and structures required to set up view port listeners.
 */
private void initializeViewportUpdate() {
  if (fViewportGuard != null)
    return;
  if (fTextWidget != null) {
    fViewportGuard= new ViewportGuard();
    fLastTopPixel= -1;
    fTextWidget.addKeyListener(fViewportGuard);
    fTextWidget.addMouseListener(fViewportGuard);
    fScroller= fTextWidget.getVerticalBar();
    if (fScroller != null)
      fScroller.addSelectionListener(fViewportGuard);
  }
}

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

/**
 * Initializes all listeners and structures required to set up view port listeners.
 */
private void initializeViewportUpdate() {
  if (fViewportGuard != null)
    return;
  if (fTextWidget != null) {
    fViewportGuard= new ViewportGuard();
    fLastTopPixel= -1;
    fTextWidget.addKeyListener(fViewportGuard);
    fTextWidget.addMouseListener(fViewportGuard);
    fScroller= fTextWidget.getVerticalBar();
    if (fScroller != null)
      fScroller.addSelectionListener(fViewportGuard);
  }
}

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

private void hsynchViewport(final TextViewer tv1, final TextViewer tv2, final TextViewer tv3) {
  final StyledText st1= tv1.getTextWidget();
  final StyledText st2= tv2.getTextWidget();
  final StyledText st3= tv3.getTextWidget();
  final ScrollBar sb1= st1.getHorizontalBar();
  sb1.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      if (fSynchronizedScrolling) {
        int v= sb1.getSelection();
        if (st2.isVisible())
          st2.setHorizontalPixel(v);
        if (st3.isVisible())
          st3.setHorizontalPixel(v);
      }
    }
  });
}

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

/**
 * Configure shell.
 */
void createContent(Composite parent) {
 canvas = new Canvas(parent, SWT.DOUBLE_BUFFERED | SWT.NONE
  | SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
 canvas.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
 origin = new org.eclipse.swt.graphics.Point(0, 0);
 size = START_SCREEN_SIZE;
 canvas.addPaintListener(this);
 canvas.addControlListener(this);
 this.layout();
 timeLabel = new Label(canvas, SWT.NONE);
 timeLabel.setText("hello world");
 timeLabel.pack();
 timeLabel.setLocation(TIME_LABEL_LOC);
 timeLabel
  .setBackground(canvas.getDisplay().getSystemColor(SWT.COLOR_WHITE));
 hBar = canvas.getHorizontalBar();
 hBar.addSelectionListener(this);
 vBar = canvas.getVerticalBar();
 vBar.addSelectionListener(this);
}

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

private void hsynchViewport(final TextViewer tv1, final TextViewer tv2, final TextViewer tv3) {
  final StyledText st1= tv1.getTextWidget();
  final StyledText st2= tv2.getTextWidget();
  final StyledText st3= tv3.getTextWidget();
  final ScrollBar sb1= st1.getHorizontalBar();
  sb1.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      if (fSynchronizedScrolling) {
        int max= sb1.getMaximum()-sb1.getThumb();
        double v= 0.0;
        if (max > 0)
          v= (float)sb1.getSelection() / (float)max;
        if (st2.isVisible()) {
          ScrollBar sb2= st2.getHorizontalBar();
          st2.setHorizontalPixel((int)((sb2.getMaximum()-sb2.getThumb()) * v));
        }
        if (st3.isVisible()) {
          ScrollBar sb3= st3.getHorizontalBar();
          st3.setHorizontalPixel((int)((sb3.getMaximum()-sb3.getThumb()) * v));
        }
        workaround65205();
      }
    }
  });
}

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

innerForm.setLayoutData(new GridData(GridData.FILL_BOTH));
final ScrollBar scrollBar = innerForm.getVerticalBar();
scrollBar.addSelectionListener(new SelectionAdapter() {
  public void widgetSelected(SelectionEvent e) {
    updateSeparatorVisibility();

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

/**
 * Installs this closer on the given table opened by the given content assistant.
 *
 * @param contentAssistant the content assistant
 * @param table the table to be tracked
 */
public void install(ContentAssistant2 contentAssistant, Table table) {
  fContentAssistant= contentAssistant;
  fTable= table;
  if (Helper2.okToUse(fTable)) {
    Shell shell= fTable.getShell();
    if (Helper2.okToUse(shell)) {
      fShell= shell;
      fShell.addShellListener(this);
    }
    fTable.addFocusListener(this);
    fScrollbar= fTable.getVerticalBar();
    if (fScrollbar != null)
      fScrollbar.addSelectionListener(this);
  }
}

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

/**
 * Installs this closer on the given table opened by the given content assistant.
 *
 * @param contentAssistant the content assistant
 * @param table the table to be tracked
 */
public void install(ContentAssistant2 contentAssistant, Table table) {
  fContentAssistant= contentAssistant;
  fTable= table;
  if (Helper2.okToUse(fTable)) {
    Shell shell= fTable.getShell();
    if (Helper2.okToUse(shell)) {
      fShell= shell;
      fShell.addShellListener(this);
    }
    fTable.addFocusListener(this);
    fScrollbar= fTable.getVerticalBar();
    if (fScrollbar != null)
      fScrollbar.addSelectionListener(this);
  }
}

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

/**
 * Installs this closer on the given table opened by the given content assistant.
 *
 * @param contentAssistant the content assistant
 * @param table the table to be tracked
 * @param additionalInfoController the additional info controller, or <code>null</code>
 * @since 3.4
 */
public void install(ContentAssistant contentAssistant, Table table, AdditionalInfoController additionalInfoController) {
  fContentAssistant= contentAssistant;
  fTable= table;
  fAdditionalInfoController= additionalInfoController;
  if (Helper.okToUse(fTable)) {
    fShell= fTable.getShell();
    fDisplay= fShell.getDisplay();
    fShell.addShellListener(this);
    fTable.addFocusListener(this);
    fScrollbar= fTable.getVerticalBar();
    if (fScrollbar != null)
      fScrollbar.addSelectionListener(this);
    fDisplay.addFilter(SWT.Activate, this);
    fDisplay.addFilter(SWT.MouseVerticalWheel, this);
    fDisplay.addFilter(SWT.Deactivate, this);
    fDisplay.addFilter(SWT.MouseUp, this);
  }
}

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

/**
 * Installs this closer on the given table opened by the given content assistant.
 *
 * @param contentAssistant the content assistant
 * @param table the table to be tracked
 * @param additionalInfoController the additional info controller, or <code>null</code>
 * @since 3.4
 */
public void install(ContentAssistant contentAssistant, Table table, AdditionalInfoController additionalInfoController) {
  fContentAssistant= contentAssistant;
  fTable= table;
  fAdditionalInfoController= additionalInfoController;
  if (Helper.okToUse(fTable)) {
    fShell= fTable.getShell();
    fDisplay= fShell.getDisplay();
    fShell.addShellListener(this);
    fTable.addFocusListener(this);
    fScrollbar= fTable.getVerticalBar();
    if (fScrollbar != null)
      fScrollbar.addSelectionListener(this);
    fDisplay.addFilter(SWT.Activate, this);
    fDisplay.addFilter(SWT.MouseVerticalWheel, this);
    fDisplay.addFilter(SWT.Deactivate, this);
    fDisplay.addFilter(SWT.MouseUp, this);
  }
}

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

ScrollBar vBar= scrollable.getVerticalBar();
if (vBar != null)
  vBar.addSelectionListener(this);
ScrollBar hBar= scrollable.getHorizontalBar();
if (hBar != null)
  hBar.addSelectionListener(this);

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

ScrollBar vBar= scrollable.getVerticalBar();
if (vBar != null)
  vBar.addSelectionListener(this);
ScrollBar hBar= scrollable.getHorizontalBar();
if (hBar != null)
  hBar.addSelectionListener(this);

相关文章