org.eclipse.swt.widgets.Spinner.getMaximum()方法的使用及代码示例

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

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

Spinner.getMaximum介绍

[英]Returns the maximum value which the receiver will allow.
[中]返回接收器允许的最大值。

代码示例

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

/**
 * Gets the default maximum of the "Example" widgets.
 */
@Override
int getDefaultMaximum () {
  return spinner1.getMaximum();
}

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

@Override
int doGetIntValue(Object source) {
  return ((Spinner) source).getMaximum();
}

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

private static void renderMaximum( Spinner spinner ) {
 renderProperty( spinner, PROP_MAXIMUM, spinner.getMaximum(), DEFAULT_MAXIMUM );
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Sets the <em>selection</em>, which is the receiver's
 * position, to the argument. If the argument is not within
 * the range specified by minimum and maximum, it will be
 * adjusted to fall within this range.
 *
 * @param value the new selection (must be zero or greater)
 *
 * @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 setSelection (int value) {
  checkWidget ();
  int min = getMinimum();
  int max = getMaximum();
  value = Math.min (Math.max (min, value), max);
  setSelection (value, true, true, false);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

value = Integer.parseInt (string);
int max = getMaximum();
int min = getMinimum();
if (min <= value && value <= max) return value;

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected void updateWidget() {
  try {
    String s= getPreferences().get(getKey());
    int number= Integer.parseInt(s);
    number= Math.max(fControl.getMinimum(), Math.min(fControl.getMaximum(), number));
    fControl.setSelection(number);
  } catch (NumberFormatException x) {
    final String message= Messages.format(FormatterMessages.ModifyDialogTabPage_NumberPreference_error_invalid_key, getKey());
    JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, message, null));
    fControl.setSelection(fControl.getMinimum());
  }
}

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

private static void writeMinMaxSelection( final Spinner spinner )
 throws IOException
{
 Integer newMin = new Integer( spinner.getMinimum() );
 Integer newMax = new Integer( spinner.getMaximum() );
 Integer newSel = new Integer( spinner.getSelection() );
 boolean minChanged = WidgetLCAUtil.hasChanged( spinner,
                         PROP_MINIMUM,
                         newMin,
                         DEFAULT_MINIMUM );
 boolean maxChanged = WidgetLCAUtil.hasChanged( spinner,
                         PROP_MAXIMUM,
                         newMax,
                         DEFAULT_MAXIMUM );
 boolean selChanged = WidgetLCAUtil.hasChanged( spinner,
                         PROP_SELECTION,
                         newSel,
                         DEFAULT_SELECTION );
 if( minChanged || maxChanged || selChanged ) {
  JSWriter writer = JSWriter.getWriterFor( spinner );
  Integer[] args = new Integer[] {
   newMin, newMax, newSel
  };
  writer.call( "setMinMaxSelection", args );
 }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Sets the minimum value that the receiver will allow.  This new
 * value will be ignored if it is greater than the receiver's
 * current maximum value.  If the new minimum is applied then the receiver's
 * selection value will be adjusted if necessary to fall within its new range.
 *
 * @param value the new minimum, which must be less than or equal to the current maximum
 *
 * @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 setMinimum (int value) {
  checkWidget ();
  int max = getMaximum();
  if (value > max) return;
  int pos = getSelection();
  buttonView.setMinValue(value);
  if (pos < value) setSelection (value, true, true, false);
}

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

public void preserveValues( final Widget widget ) {
 Spinner spinner = ( Spinner )widget;
 ControlLCAUtil.preserveValues( spinner );
 IWidgetAdapter adapter = WidgetUtil.getAdapter( widget );
 adapter.preserve( PROP_SELECTION, new Integer( spinner.getSelection() ) );
 adapter.preserve( PROP_MINIMUM, new Integer( spinner.getMinimum() ) );
 adapter.preserve( PROP_MAXIMUM, new Integer( spinner.getMaximum() ) );
 adapter.preserve( PROP_DIGITS, new Integer( spinner.getDigits() ) );
 adapter.preserve( PROP_INCREMENT, new Integer( spinner.getIncrement() ) );
 adapter.preserve( PROP_PAGE_INCREMENT,
          new Integer( spinner.getPageIncrement() ) );
 adapter.preserve( PROP_MODIFY_LISTENER,
          Boolean.valueOf( ModifyEvent.hasListener( spinner ) ) );
 adapter.preserve( PROP_SELECTION_LISTENER,
          Boolean.valueOf( SelectionEvent.hasListener( spinner ) ) );
 adapter.preserve( PROP_TEXT_LIMIT, new Integer( spinner.getTextLimit() ) );
 adapter.preserve( PROP_DECIMAL_SEPARATOR, getDecimalSeparator() );
 WidgetLCAUtil.preserveCustomVariant( spinner );
}

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

@Override
public void preserveValues( Spinner spinner ) {
 preserveProperty( spinner, PROP_MINIMUM, spinner.getMinimum() );
 preserveProperty( spinner, PROP_MAXIMUM, spinner.getMaximum() );
 preserveProperty( spinner, PROP_SELECTION, spinner.getSelection() );
 preserveProperty( spinner, PROP_DIGITS, spinner.getDigits() );
 preserveProperty( spinner, PROP_INCREMENT, spinner.getIncrement() );
 preserveProperty( spinner, PROP_PAGE_INCREMENT, spinner.getPageIncrement() );
 preserveProperty( spinner, PROP_TEXT_LIMIT, getTextLimit( spinner ) );
 preserveProperty( spinner, PROP_DECIMAL_SEPARATOR, getDecimalSeparator() );
}

相关文章