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


Java Slider类代码示例

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


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

示例1: isAvailable

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
/**
 * <p>
 * Tells whether the SWT Browser widget and hence this information control is
 * available.
 * </p>
 * 
 * @param parent the parent component used for checking or <code>null</code> if
 * none
 * 
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent) {
	if (!fgAvailabilityChecked) {
		try {
			Browser browser= new Browser(parent, SWT.NONE);
			browser.dispose();
			fgIsAvailable= true;
			
			Slider sliderV= new Slider(parent, SWT.VERTICAL);
			Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
			int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
			int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
			fgScrollBarSize= new Point(width, height);
			sliderV.dispose();
			sliderH.dispose();
		} catch (SWTError er) {
			fgIsAvailable= false;
		} finally {
			fgAvailabilityChecked= true;
		}
	}
	
	return fgIsAvailable;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:35,代码来源:DwprofileBrowserInformationControl.java

示例2: setSlider

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
public void setSlider(Slider slider) {
	if (b.text != null && !b.text.isDisposed()) {
		sliderListener = new Listener() {

			@Override
			public void handleEvent(Event arg0) {
				// TODO Auto-generated method stub
				if (slider != null && !slider.isDisposed()) {
					ScrollBar vb = b.text.getVerticalBar();
					slider.setValues(vb.getSelection(), vb.getMinimum(), vb.getMaximum(), vb.getThumb(),
							vb.getIncrement(), vb.getPageIncrement());
				}
			}
		};
		b.text.addListener(SWT.Paint, sliderListener);
	}
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:18,代码来源:blackAction.java

示例3: 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

示例4: startSliderUpdate

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
private void startSliderUpdate(final Slider sliderStartDate, final Label startDateLabel, Integer sliderValue) {

        Date maxDate= maxDate();
        Date minDate= minimumDate();
        Integer maxSlider= 100;
        Integer minSlider= 0;
        Integer perCentValue = sliderValue*100/(maxSlider - minSlider - sliderStartDate.getThumb());

        Long diffDateInDays = (maxDate.getTime() - minDate.getTime())/(1000*3600*24);
        Long nbDaySinceMin  = perCentValue * diffDateInDays /100;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(minDate);
        calendar.add(Calendar.DAY_OF_YEAR, nbDaySinceMin.intValue());
        slidingStartDate = DateFactory.midnithDate(calendar.getTime());

        startDateLabel.setText(DateFormat.getDateInstance(DateFormat.MEDIUM).format(slidingStartDate));
        startDateLabel.setFont(MainGui.DEFAULTFONT);
    }
 
开发者ID:premiummarkets,项目名称:pm,代码行数:19,代码来源:ChartsComposite.java

示例5: 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

示例6: endSliderUpdate

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
private void endSliderUpdate(Slider sliderEndDate, Label endDateLabel, Integer sliderValue) {

        Date maxDate= maxDate();
        Date minDate= minimumDate();
        Integer maxSlider= 100;
        Integer minSlider= 0;
        Integer perCentValue = sliderValue*100/ (maxSlider - minSlider - sliderEndDate.getThumb());

        Long diffDate = (maxDate.getTime() - minDate.getTime())/(1000*3600*24);
        Long nbDaySinceMin  = perCentValue * diffDate /100;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(minDate);
        calendar.add(Calendar.DAY_OF_YEAR, nbDaySinceMin.intValue());
        slidingEndDate = DateFactory.midnithDate(calendar.getTime());

        endDateLabel.setText(DateFormat.getDateInstance(DateFormat.MEDIUM).format(slidingEndDate));
        endDateLabel.setFont(MainGui.DEFAULTFONT);

    }
 
开发者ID:premiummarkets,项目名称:pm,代码行数:20,代码来源:ChartsComposite.java

示例7: 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

示例8: isAvailableFor

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
/**
 * Tells whether this control is available for given parent composite
 * 
 * @param parent
 *            the parent component used for checking or <code>null</code> if
 *            none
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailableFor(Composite parent) {
	if (!browserAvailabilityChecked) {
		try {
			Browser browser = new Browser(parent, SWT.NONE);
			browser.dispose();
			swtBrowserCanBeUsed = true;

			/* compute scrollbar size */
			Slider sliderV = new Slider(parent, SWT.VERTICAL);
			Slider sliderH = new Slider(parent, SWT.HORIZONTAL);

			int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
			int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;

			cachedScrollBarSize = new Point(width, height);

			sliderV.dispose();
			sliderH.dispose();

		} catch (SWTError er) {
			swtBrowserCanBeUsed = false;
		} finally {
			browserAvailabilityChecked = true;
		}
	}

	return swtBrowserCanBeUsed;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:37,代码来源:ReducedBrowserInformationControl.java

示例9: FrameView

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
FrameView(Composite parent) {
	super(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	setLayout(layout);
	setBackground(ColorConstants.white);
	header = new Label(this, SWT.BORDER);
	header.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	FontManager.setFont(header, Constants.MESSAGE_FONT_SIZE);

	viewer = new FrameViewer(this);

	slider = new Slider(this, SWT.HORIZONTAL | SWT.BORDER);
	slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	slider.setMinimum(1);
	slider.setMaximum(1);
	slider.setIncrement(1);
	slider.addSelectionListener(new SelectionAdapter() {
		int sel = slider.getSelection();
		@Override
		public void widgetSelected(SelectionEvent e) {
			if(slider.getSelection() != sel) {
				model.setStep(slider.getSelection()-1);
				sel = slider.getSelection();
				PandionJUI.navigateToLine(model.getSourceFile(), model.getStepLine());
				//				slider.setToolTipText(slider.getSelection() + "/" + slider.getMaximum());
			}
		}
	});
	slider.setVisible(false);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:FrameView.java

示例10: 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

示例11: getResizeHandleSize

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
private int getResizeHandleSize(Composite parent)
{
	if (fResizeHandleSize == -1)
	{
		Slider sliderV = new Slider(parent, SWT.VERTICAL);
		Slider sliderH = new Slider(parent, SWT.HORIZONTAL);
		int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
		int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
		sliderV.dispose();
		sliderH.dispose();
		fResizeHandleSize = Math.min(width, height);
	}

	return fResizeHandleSize;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:16,代码来源:CustomAbstractInformationControl.java

示例12: isAvailable

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
/**
 * Tells whether the SWT Browser widget and hence this information control is available.
 * 
 * @param parent
 *            the parent component used for checking or <code>null</code> if none
 * @return <code>true</code> if this control is available
 */
public static boolean isAvailable(Composite parent)
{
	if (!fgAvailabilityChecked)
	{
		try
		{
			Browser browser = new Browser(parent, SWT.NONE);
			browser.dispose();
			fgIsAvailable = true;

			Slider sliderV = new Slider(parent, SWT.VERTICAL);
			Slider sliderH = new Slider(parent, SWT.HORIZONTAL);
			int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
			int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
			fgScrollBarSize = new Point(width, height);
			sliderV.dispose();
			sliderH.dispose();
		}
		catch (SWTError er)
		{
			fgIsAvailable = false;
		}
		finally
		{
			fgAvailabilityChecked = true;
		}
	}

	return fgIsAvailable;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:38,代码来源:CustomBrowserInformationControl.java

示例13: placeComponents

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
protected void placeComponents( int style )
{
	GridLayout gl = new GridLayout( 1, false );
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginLeft = 0;
	gl.marginRight = 0;
	gl.marginTop = 0;
	gl.marginWidth = 0;
	this.setLayout( gl );
	
	slider = new Slider( this, style );
	GridData gd = new GridData( GridData.FILL_BOTH );
	slider.setLayoutData( gd );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:16,代码来源:ChartSlider.java

示例14: getControl

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
@Test
public void getControl() {
  FlatScrollBar scrollBar = createScrollBar();
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();

  Control actual = mouseWheelSupport.getControl();

  assertThat( actual ).isInstanceOf( Slider.class );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:11,代码来源:MouseWheelSupportTest.java

示例15: copySettingsIfSliderHasLayoutData

import org.eclipse.swt.widgets.Slider; //导入依赖的package包/类
@Test
public void copySettingsIfSliderHasLayoutData() {
  FlatScrollBar scrollBar = createScrollBar();
  Rectangle expected = new Rectangle( 10, 20, 30, 40 );
  scrollBar.setBounds( expected );
  MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
  mouseWheelSupport.create();
  Slider slider = ( Slider )mouseWheelSupport.getControl();
  slider.setLayoutData( new FormData() );
  scrollBar.setBounds( new Rectangle( 50, 60, 70, 80 ) );

  mouseWheelSupport.copySettings();

  assertThat( slider.getBounds() ).isEqualTo( expected  );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:16,代码来源:MouseWheelSupportTest.java


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