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


Java Scale类代码示例

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


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

示例1: renderTransparency

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
private void renderTransparency(final Shell shell) {
	Group group = new Group(shell, SWT.NONE);
	group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
	group.setLayout(new GridLayout(1, false));
	group.setText("Transparency");
	final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
	transparencySlider.setMinimum(20);
	transparencySlider.setMaximum(100);
	transparencySlider.setPageIncrement(90);
	transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	transparencySlider.setSelection(100);
	transparencySlider.addListener(SWT.Selection, new Listener() {

		@Override
		public void handleEvent(Event event) {
			shell.setAlpha(255 * transparencySlider.getSelection() / 100);
		}
	});
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:20,代码来源:FindReplaceDialog.java

示例2: transparencyTest

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
@ScreenshotCheck
@Test(timeout = 300000)
@Keywords(keywords = "swt")
public void transparencyTest() throws Throwable {
    final Scale scale = alphaSlider.getControl();
    final AtomicInteger scaleProp = new AtomicInteger();
    scale.getDisplay().syncExec(new Runnable() {
        public void run() {
            scaleProp.set((scale.getMaximum() - scale.getMinimum()) / 2);
        }
    });
    setScale(scale, scaleProp.get());
    checkScreenshot("SWTInteropTest-transparency", contentPane);
    scale.getDisplay().syncExec(new Runnable() {
        public void run() {
            scaleProp.set(scale.getMaximum());
        }
    });
    setScale(scale, scaleProp.get());
    throwScreenshotError();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:FXCanvasTest.java

示例3: fillSynthGainScale

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
protected void fillSynthGainScale( Scale scale ){
	double[] range = getSynth().getDoublePropertyRange( MidiSettings.SYNTH_GAIN );
	if( range.length == 2 ){
		int value = (int)Math.round( getDoubleValue( MidiSettings.SYNTH_GAIN ) * 10f );
		int minimum = (int)Math.round( range[0] * 10 );
		int maximum = (int)Math.round( range[1] * 10 );
		if( minimum < maximum ){
			scale.setMinimum( minimum );
			scale.setMaximum( maximum );
			scale.setIncrement(1);
			scale.setPageIncrement(10);
			if( value >= minimum && value <= maximum ){
				scale.setSelection( value );
			}
		}
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:18,代码来源:MidiOutputPortSettings.java

示例4: showShell

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
public void showShell() {
	if( isShellDisposed() ){
		this.shell = new Shell( this.item.getShell(), SWT.NO_TRIM );
		this.shell.setVisible(false);
		this.shell.setLayout(getGridLayout());
		
		this.composite = new Composite(this.shell, SWT.BORDER);
		this.composite.setLayout(getGridLayout());
		this.composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		
		this.scale = new Scale(this.composite, SWT.VERTICAL );
		this.scale.setMaximum(127);
		this.scale.setMinimum(0);
		this.scale.setIncrement(1);
		this.scale.setPageIncrement(64);
		this.scale.setLayoutData(getScaleLayoutData());
		this.setValueToScale();
		this.addDefaultListeners();
		
		this.shell.pack();
		this.moveShell();
		this.shell.setVisible(true);
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:25,代码来源:TGScalePopup.java

示例5: IntValue

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
public IntValue(Composite parent, int initialValue) {
	inputField = new Text(parent, SWT.BORDER | SWT.SINGLE);
	outputField = new Label(parent, SWT.NONE);
	scale = new Scale(parent, SWT.HORIZONTAL);

	inputField.setText(Integer.toString(initialValue));
	outputField.setText(msgForValue(initialValue));
	scale.setMinimum(0);
	scale.setMaximum(100);
	scale.setSelection(initialValue);

	Layouts.setGrid(parent);
	Layouts.setGridData(inputField).grabHorizontal();
	Layouts.setGridData(outputField).grabHorizontal();
	Layouts.setGridData(scale).grabHorizontal();
}
 
开发者ID:diffplug,项目名称:rxjava-and-swt,代码行数:17,代码来源:EventVsFrpTwoWay.java

示例6: testControl

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
@Test
public void testControl() {
	InteractiveTest.testCoat("Should show the YCbCr plane at various values of Y", cmp -> {
		Layouts.setGrid(cmp);

		Scale scale = new Scale(cmp, SWT.HORIZONTAL);
		scale.setMinimum(0);
		scale.setMaximum(255);
		scale.setSelection(128);
		Layouts.setGridData(scale).grabHorizontal();

		ColorPicker colors = new ColorPicker(cmp);
		Layouts.setGridData(colors).grabAll();

		scale.addListener(SWT.Selection, e -> {
			colors.setY(scale.getSelection());
		});
	});
}
 
开发者ID:diffplug,项目名称:rxjava-and-swt,代码行数:20,代码来源:ColorPickerTest.java

示例7: createScale

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
/**
 * Creates the scale or slider widget that can be used to quickly traverse
 * the timesteps.
 * 
 * @param parent
 *            The parent Composite for this widget. Assumed not to be
 *            {@code null}.
 * @return The new widget.
 */
private Scale createScale(Composite parent) {

	final Scale scale = new Scale(this, SWT.HORIZONTAL);
	scale.setMinimum(0);
	scale.setIncrement(1);
	scale.setMaximum(0);
	scale.setToolTipText("Traverses the timesteps");

	scale.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			// Disable playback.
			setPlayback(false, e);

			// Get the timestep from the scale widget.
			if (setValidTimestep(scale.getSelection())) {
				notifyListeners(e);
			}
		}
	});

	return scale;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:33,代码来源:TimeSliderComposite.java

示例8: adjustScaleValueOnMouseScroll

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
public static void adjustScaleValueOnMouseScroll(final MouseEvent event) {

		boolean isCtrlKey;
		boolean isShiftKey;

		if (IS_OSX) {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD3) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		} else {
			isCtrlKey = (event.stateMask & SWT.MOD1) > 0;
			isShiftKey = (event.stateMask & SWT.MOD2) > 0;
			//			isAltKey = (event.stateMask & SWT.MOD3) > 0;
		}

		// accelerate with Ctrl + Shift key
		int accelerator = isCtrlKey ? 10 : 1;
		accelerator *= isShiftKey ? 5 : 1;

		final Scale scale = (Scale) event.widget;
		final int increment = scale.getIncrement();
		final int oldValue = scale.getSelection();
		final int valueDiff = ((event.count > 0 ? increment : -increment) * accelerator);

		scale.setSelection(oldValue + valueDiff);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:27,代码来源:UI.java

示例9: SliderImpl

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
public SliderImpl(final Object parentUiReference, final ISliderSetupSpi setup, final SwtImageRegistry imageRegistry) {
    super(new Scale((Composite) parentUiReference, getStyle(setup)), imageRegistry);

    this.orientation = setup.getOrientation();

    final Scale scale = getUiReference();

    scale.setMaximum(setup.getMaximum());
    scale.setMinimum(setup.getMinimum());
    scale.setSelection(setup.getMinimum());
    scale.setPageIncrement(setup.getTickSpacing());
    scale.setToolTipText(setup.getToolTipText());

    scale.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            fireInputChanged(getSelection());
        }
    });
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:21,代码来源:SliderImpl.java

示例10: setUpClass

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
    System.setProperty("javafx.swtinteroperability", "true");
    FXCanvasApp.main(null);
    JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
    frame = Shells.SHELLS.lookup().wrap();
    frameAsParent = frame.as(Parent.class);
    menuBtn = frameAsParent.lookup(org.eclipse.swt.widgets.Button.class, new ByText(FXCanvasApp.MENU_POPUP_BTN)).wrap();
    alphaSlider = frameAsParent.lookup(Scale.class).wrap();
    fxpane = frameAsParent.lookup(FXCanvas.class).wrap();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:FXCanvasTest.java

示例11: setScale

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
protected static void setScale(final Scale scale, final int value) {
    final Event event = new Event();
    event.type = SWT.Selection;
    event.widget = scale;
    scale.getDisplay().syncExec(new Runnable() {
        public void run() {
            scale.setSelection(value);
            scale.notifyListeners(SWT.Selection, event);
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:FXCanvasTest.java

示例12: XkcdColorPicker

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
public XkcdColorPicker(Composite parent, RGB initRGB) {
	super(new Composite(parent, SWT.NONE));
	RGB initYCbCr = ColorPicker.toYCbCr(initRGB);

	// create a scale and bind it to an RxBox<Integer>
	RxBox<Integer> luminance = RxBox.of(initYCbCr.red);

	// colorpanel in the center
	ColorPicker cbcrPanel = new ColorPicker(wrapped);
	Rx.subscribe(luminance, cbcrPanel::setY);

	// controls at the right
	Composite rightCmp = new Composite(wrapped, SWT.NONE);

	// scale below
	Scale scale = new Scale(wrapped, SWT.HORIZONTAL);
	scale.setMinimum(0);
	scale.setMaximum(255);
	Rx.subscribe(luminance, scale::setSelection);
	scale.addListener(SWT.Selection, e -> {
		luminance.set(scale.getSelection());
	});

	Layouts.setGrid(wrapped).numColumns(2);
	Layouts.setGridData(cbcrPanel).grabAll();
	Layouts.setGridData(rightCmp).grabVertical().verticalSpan(2);
	Layouts.setGridData(scale).grabHorizontal();

	// populate the bottom
	Layouts.setGrid(rightCmp).margin(0);
	XkcdColors.Lookup xkcdLookup = new XkcdColors.Lookup(rightCmp);

	Group hoverGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	hoverGrp.setText("Hover");
	createGroup(hoverGrp, cbcrPanel.rxMouseMove(), xkcdLookup);

	Group clickGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	clickGrp.setText("Click");
	createGroup(clickGrp, cbcrPanel.rxMouseDown(), xkcdLookup);
}
 
开发者ID:diffplug,项目名称:rxjava-and-swt,代码行数:41,代码来源:XkcdColorPicker.java

示例13: createComponent

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
protected void createComponent(Composite parent) {
	composite = section.getWidgetFactory().createComposite(parent);
	RowLayout layout = new RowLayout(SWT.HORIZONTAL);
	layout.wrap = true;
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.center = true;
	composite.setLayout(layout);

	scale = new Scale(composite, SWT.HORIZONTAL);
	scale.setMinimum(0);
	scale.setMaximum(100);
	scale.setIncrement(1);
	scale.setPageIncrement(5);
	RowData rd = new RowData();
	rd.width = 100;
	scale.setLayoutData(rd);
	scale.setToolTipText(pDescriptor.getDescription());
	scale.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (!isRefresh)
				ftext.setText("" + (scale.getSelection() / 100f));
		}
	});

	super.createComponent(composite);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:29,代码来源:SPTransparency.java

示例14: createControls

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
/**
    * Creates the controls.
    * 
    * @param parent
    *            the parent
    * @param initialPixelsPerSecond
    *            the initial pixels per second
    */
   protected void createControls(Composite parent, double initialPixelsPerSecond) {
this.setLayout(new GridLayout(1, false));
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
this.setLayoutData(gd);
pixPerSecondsScale = new Scale(this, SWT.HORIZONTAL);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
pixPerSecondsScale.setLayoutData(gd);
this.setPixelsPerSecond(initialPixelsPerSecond);

pixPerSecondsScale.addSelectionListener(new SelectionListener() {
    public void widgetDefaultSelected(SelectionEvent arg0) {
    }

    public void widgetSelected(SelectionEvent ev) {
	int val = pixPerSecondsScale.getSelection();
	double pps = (((double) val) * pixelsPerSecond) / 100;
	for (TimeScaleListener l : listeners) {
	    l.timeScaleChanged(pps);
	}
    }
});
   }
 
开发者ID:synergynet,项目名称:synergyview,代码行数:36,代码来源:TimeScaleBar.java

示例15: createScale

import org.eclipse.swt.widgets.Scale; //导入依赖的package包/类
/**
 * 
 * @param shell : the Shell object used
 * @param intMin : the Integer minimum value of the scale bar
 * @param intMax : the Integer maximum value of the scale bar
 * @param intIncrements : the Integer number of increments
 * @param intPageIncrement : the Integer step of the scale bar
 * @param intSetSelection : the Integer initial value of the slider
 * @return Scale widget
 */
public Scale createScale(Shell shell, int intMin, int intMax, int intIncrements, int intPageIncrement, int intSetSelection) {

	Scale myScale = new Scale(shell, SWT.HORIZONTAL);

	myScale.setMinimum(intMin);
	myScale.setMaximum(intMax);
	myScale.setIncrement(intIncrements);
	myScale.setPageIncrement(intPageIncrement);
	myScale.setSelection(intSetSelection);

	return myScale;

}
 
开发者ID:MikeFot,项目名称:Java--GIS-Shapefile-Parser-and-Processor,代码行数:24,代码来源:WidgetFactory.java


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