org.eclipse.swt.widgets.Scale类的使用及代码示例

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

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

Scale介绍

[英]Instances of the receiver represent a selectable user interface object that present a range of continuous numeric values. Styles: HORIZONTAL, VERTICAL Events: Selection

Note: Only one of the styles HORIZONTAL and VERTICAL may be specified.

IMPORTANT: This class is intended to be subclassed only within the SWT implementation.
[中]接收器的实例表示一个可选的用户界面对象,该对象表示一系列连续的数值。样式:水平、垂直事件:选择
注:只能指定水平和垂直两种样式中的一种。
重要提示:该类仅在SWT实现中被子类化。

代码示例

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

@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() );
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.ws.consumption.ui

private void setClientScale(int setting)
{
  clientScale_.setSelection(setting);
  clientScaleSetting_ = setting;
}

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

/**
 * 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;
}

代码示例来源:origin: BiglySoftware/BiglyBT

@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;
}

代码示例来源:origin: atdl4j/atdl4j

@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() );
    }
  }
}

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

/**
 * 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());
  }
}

代码示例来源:origin: diffplug/gradle-and-eclipse-rcp

@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());
      });
    });
  }
}

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

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();
}));

代码示例来源:origin: inspectIT/inspectIT

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);

代码示例来源:origin: diffplug/gradle-and-eclipse-rcp

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();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);

代码示例来源:origin: org.eclipse/org.eclipse.jst.ws.consumption.ui

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);

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void
  handleEvent(Event event)
  {
    if ( !slider_mouse_down[0]){
      int pos = privacy_scale.getSelection();
      int level = ((pos+5)/10);
      setPrivacyLevel( level );
    }
  }
});

代码示例来源:origin: BiglySoftware/BiglyBT

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()

代码示例来源:origin: atdl4j/atdl4j

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 );

代码示例来源:origin: org.xworker/xworker_swt

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));

代码示例来源:origin: Nodeclipse/EditBox

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) {

代码示例来源:origin: stackoverflow.com

scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scale.setMaximum (4);
scale.setPageIncrement (1);
scale.setSelection(4);

代码示例来源:origin: diffplug/gradle-and-eclipse-rcp

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());
  });
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * 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);
}

相关文章