当前位置: 首页>>代码示例>>Java>>正文


Java Slider.setSelection方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Slider.setSelection方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.setSelection方法的具体用法?Java Slider.setSelection怎么用?Java Slider.setSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Slider的用法示例。


在下文中一共展示了Slider.setSelection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startSliderUpdateConditional

import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
private void startSliderUpdateConditional(final Slider sliderStartDate, final Label startDateLabel, Slider sliderEndDate,  Label endDateLabel) {

        synchronized (sliderEndDate) {
            sliderSelection = true;
        }

        Integer startSliderValue = sliderStartDate.getSelection();

        if (sliderEndDate.getSelection() - sliderStartDate.getSelection() <= MINSLIDERVALUE) {
            if (sliderEndDate.getSelection() <= 100-MINSLIDERVALUE) {
                int endValue = startSliderValue+MINSLIDERVALUE;
                sliderEndDate.setSelection(endValue);
                endSliderUpdate(sliderEndDate, endDateLabel, endValue);
            } else {
                sliderEndDate.setSelection(99);
                endSliderUpdate(sliderEndDate, endDateLabel, 99);
                startSliderValue=100-MINSLIDERVALUE;
                sliderStartDate.setSelection(100-MINSLIDERVALUE);
            }

        }

        startSliderUpdate(sliderStartDate, startDateLabel, startSliderValue);

        slidingGroup.layout();
    }
 
开发者ID:premiummarkets,项目名称:pm,代码行数:27,代码来源:ChartsComposite.java

示例2: endSliderUpdateConditional

import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
private void endSliderUpdateConditional( Slider sliderEndDate,  Label endDateLabel,  Slider sliderStartDate, Label startDateLabel) {

        synchronized (sliderEndDate) {
            sliderSelection = true;
        }


        Integer sliderValue = sliderEndDate.getSelection();

        if (sliderEndDate.getSelection() - sliderStartDate.getSelection() <= MINSLIDERVALUE) {
            if (sliderStartDate.getSelection() >= MINSLIDERVALUE) {
                int startValue = sliderValue-MINSLIDERVALUE;
                sliderStartDate.setSelection(startValue);
                startSliderUpdate(sliderStartDate, startDateLabel, startValue);
            } else {
                sliderStartDate.setSelection(0);
                startSliderUpdate(sliderStartDate, startDateLabel, 0);
                sliderValue = MINSLIDERVALUE;
                sliderEndDate.setSelection(MINSLIDERVALUE);
            }
        }

        endSliderUpdate(sliderEndDate, endDateLabel, sliderValue);

        slidingGroup.layout();
    }
 
开发者ID:premiummarkets,项目名称:pm,代码行数:27,代码来源:ChartsComposite.java

示例3: updateScrollBarSelection

import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
@Test
public void updateScrollBarSelection() {
  FlatScrollBar scrollBar = createScrollBar();
  SelectionListener listener = equipScrollBarWithListener( scrollBar );
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();
  Slider slider = ( Slider )mouseWheelSupport.getControl();
  slider.setSelection( 10 );

  mouseWheelSupport.updateScrollBarSelection( direction );

  SelectionEvent event = verifyNotification( listener );
  assertThat( event.widget ).isSameAs( scrollBar );
  assertThat( event.detail ).isEqualTo( direction );
  assertThat( scrollBar.getSelection() ).isEqualTo( 10 );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:17,代码来源:MouseWheelSupportTest.java

示例4: createDialogArea

import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		container.setLayout(new GridLayout(5, false));
		
		Label gl = new Label(container, 0);
		gl.setText("Gamma correction: ");
		
	    gammaSlider = new Slider(container, SWT.HORIZONTAL);
	    gammaSlider.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	    gammaSlider.setIncrement(1);
	    gammaSlider.setValues(1, 1, 100, 1, 1, 1);
	    gammaSlider.setSelection(50);
	    gammaSlider.addSelectionListener(new SelectionAdapter() {			
			@Override public void widgetSelected(SelectionEvent e) {
				updateGammaValue();
			}
		});
	    
	    gammaValueLabel = new Label(container, 0);
	    
	    applyGammaBtn = new Button(container, SWT.PUSH);
	    applyGammaBtn.setText("Apply");
	    
	    defaultGammaBtn = new Button(container, SWT.PUSH);
	    defaultGammaBtn.setText("Default");
//	    defaultGammaBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
	    
	    updateSliderValueFromGamma();
	    
	    addListener();
		
		return container;
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:38,代码来源:ImageEnhanceDialog.java

示例5: TreeViewControls

import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
public TreeViewControls(Composite parent) {
    super(parent, SWT.NONE);
    GridLayout layout = new GridLayout(5, false);
    layout.marginWidth = layout.marginHeight = 2;
    layout.verticalSpacing = layout.horizontalSpacing = 4;
    setLayout(layout);

    Label filterLabel = new Label(this, SWT.NONE);
    filterLabel.setText("Filter by class or id:");
    filterLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));

    mFilterText = new Text(this, SWT.LEFT | SWT.SINGLE);
    mFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mFilterText.addModifyListener(mFilterTextModifyListener);
    mFilterText.setText(HierarchyViewerDirector.getDirector().getFilterText());

    Label smallZoomLabel = new Label(this, SWT.NONE);
    smallZoomLabel.setText(" 20%");
    smallZoomLabel
            .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));

    mZoomSlider = new Slider(this, SWT.HORIZONTAL);
    GridData zoomSliderGridData = new GridData(GridData.CENTER, GridData.CENTER, false, false);
    zoomSliderGridData.widthHint = 190;
    mZoomSlider.setLayoutData(zoomSliderGridData);
    mZoomSlider.setMinimum((int) (TreeViewModel.MIN_ZOOM * 10));
    mZoomSlider.setMaximum((int) (TreeViewModel.MAX_ZOOM * 10 + 1));
    mZoomSlider.setThumb(1);
    mZoomSlider.setSelection((int) Math.round(TreeViewModel.getModel().getZoom() * 10));

    mZoomSlider.addSelectionListener(mZoomSliderSelectionListener);

    Label largeZoomLabel = new Label(this, SWT.NONE);
    largeZoomLabel
            .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));
    largeZoomLabel.setText("200%");

    addDisposeListener(mDisposeListener);

    TreeViewModel.getModel().addTreeChangeListener(this);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:42,代码来源:TreeViewControls.java


注:本文中的org.eclipse.swt.widgets.Slider.setSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。