@Override public void preserveValues( Scale scale ) { preserveProperty( scale, PROP_MINIMUM, scale.getMinimum() ); preserveProperty( scale, PROP_MAXIMUM, scale.getMaximum() ); preserveProperty( scale, PROP_SELECTION, scale.getSelection() ); preserveProperty( scale, PROP_INCREMENT, scale.getIncrement() ); preserveProperty( scale, PROP_PAGE_INCREMENT, scale.getPageIncrement() ); }
private void setClientScale(int setting) { clientScale_.setSelection(setting); clientScaleSetting_ = setting; }
/** * Returns this field editor's scale control. The control is created if it * does not yet exist. * * @param parent * the parent * @return the scale control */ private Scale getScaleControl(Composite parent) { if (scale == null) { scale = new Scale(parent, SWT.HORIZONTAL); scale.setFont(parent.getFont()); scale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { valueChanged(); } }); scale.addDisposeListener(event -> scale = null); } else { checkParent(scale, parent); } return scale; }
@Override public void mouseUp( MouseEvent e ) { int pos = privacy_scale.getSelection(); int level = ((pos+5)/10); if ( level*10 != pos ){ privacy_scale.setSelection( level*10 ); } setPrivacyLevel( level ); slider_mouse_down[0] = false; }
@Override public void processReinit( Object aControlInitValue ) { if ( ( slider != null ) && ( ! slider.isDisposed() ) ) { if ( aControlInitValue != null ) { // -- apply initValue if one has been specified -- setValue( (String) aControlInitValue, true ); } else { // -- set to minimum when no initValue exists -- slider.setSelection( slider.getMinimum() ); } } }
/** * Update the scale particulars with set values. */ private void updateScale() { if (scale != null && !scale.isDisposed()) { scale.setMinimum(getMinimum()); scale.setMaximum(getMaximum()); scale.setIncrement(getIncrement()); scale.setPageIncrement(getPageIncrement()); } }
@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()); }); }); } }
label.setText(getResourceString("settings.AirbrushRadius.text")); final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushRadiusScale.setMinimum(5); airbrushRadiusScale.setMaximum(50); airbrushRadiusScale.setSelection(toolSettings.airbrushRadius); airbrushRadiusScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushRadiusScale.addSelectionListener(widgetSelectedAdapter(e -> { toolSettings.airbrushRadius = airbrushRadiusScale.getSelection(); updateToolSettings(); })); label.setText(getResourceString("settings.AirbrushIntensity.text")); final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); airbrushIntensityScale.setMinimum(1); airbrushIntensityScale.setMaximum(100); airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity); airbrushIntensityScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); airbrushIntensityScale.addSelectionListener(widgetSelectedAdapter(e -> { toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection(); updateToolSettings(); }));
sliderLabel.setLayoutData(data); slider = new Scale(composite, SWT.HORIZONTAL); toolkit.adapt(slider, true, true); slider.setMinimum(0); slider.setMaximum(Sensitivity.values().length - 1); slider.setIncrement(1); slider.setSize(200, 10); slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); slider.addSelectionListener(new SelectionAdapter() { slider.setSelection(DEFAULT_SENSITIVITY.ordinal()); slider.notifyListeners(SWT.Selection, null);
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(); }
checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Selection,typedListener); addListener (SWT.DefaultSelection,typedListener);
clientComposite_.setLayoutData(scGridData); clientScale_ = new Scale(clientComposite_ , SWT.VERTICAL | SWT.BORDER); utils_.createInfoPop(clientScale_, INFOPOP_WSWSCEN_SCALE_CLIENT); clientScale_.setMinimum(0); clientScale_.setMaximum(6); clientScale_.setIncrement(1); clientScale_.addSelectionListener(scaleSelectionListener); setClientScale(getClientGeneration()); clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT); Accessible accessibleScale = clientScale_.getAccessible(); accessibleScale.addAccessibleListener(new AccessibleAdapter(){ layoutData1.heightHint=scaleR.height; layoutData1.widthHint=scaleR.width+1; clientScale_.setLayoutData(layoutData1);
@Override public void handleEvent(Event event) { if ( !slider_mouse_down[0]){ int pos = privacy_scale.getSelection(); int level = ((pos+5)/10); setPrivacyLevel( level ); } } });
label.setLayoutData(gd); privacy_scale = new Scale(slider2_comp, SWT.HORIZONTAL); privacy_scale.setLayoutData(gd); privacy_scale.setMinimum( 0 ); privacy_scale.setMaximum( 30 ); privacy_scale.addMouseListener( new MouseAdapter() privacy_scale.addListener( SWT.Selection, new Listener()
slider = new Scale( c, style | SWT.HORIZONTAL ); slider.setIncrement( 1 ); slider.setPageIncrement( 1 ); GridData sliderData = new GridData( SWT.FILL, SWT.FILL, true, false ); sliderData.horizontalSpan = numColumns; slider.setLayoutData( sliderData ); slider.setMaximum( numColumns > 1 ? numColumns - 1 : 1 ); slider.setToolTipText( tooltip ); label.setToolTipText( tooltip );
Scale scale = new Scale(parent, style); scale.setIncrement(self.getInt("increment", 1)); scale.setMaximum(self.getInt("maximum", 1)); scale.setMinimum(self.getInt("minimum", 1)); scale.setPageIncrement(self.getInt("pageIncrement", 1));
la.setLayoutData(gd); scale = new Scale(c, SWT.HORIZONTAL); scale.setToolTipText("Can slow down box drawing"); gd = new GridData(); gd.horizontalSpan = 1; gd.widthHint = 80; scale.setLayoutData(gd); scale.setMinimum(0); scale.setMinimum(255); scale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {
scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scale.setMaximum (4); scale.setPageIncrement (1); scale.setSelection(4);
public EventBased(Composite parent, int initialValue) { super(parent, initialValue); this.value = initialValue; inputField.addListener(SWT.Modify, e -> { try { int parsed = Integer.parseInt(inputField.getText()); setValue(parsed); } catch (Exception error) { outputField.setText(msgForError(error)); } }); scale.addListener(SWT.Selection, e -> { setValue(scale.getSelection()); }); }
/** * Sets the maximum value that the receiver will allow. This new * value will be ignored if it is not greater than the receiver's current * minimum value. If the new maximum is applied then the receiver's * selection value will be adjusted if necessary to fall within its new range. * * @param value the new maximum, which must be greater than the current minimum * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setMaximum (int value) { checkWidget (); int minimum = getMinimum(); if (value <= minimum) return; OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_range_set_range (handle, minimum, value); OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); }