javax.swing.text.NumberFormatter.stringToValue()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(105)

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

NumberFormatter.stringToValue介绍

暂无

代码示例

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

@Override
public Object stringToValue(String text) throws ParseException {
  Number value = (Number) numberFormatter.stringToValue(text);
  if (value.intValue() < minValue) {
    throw new ParseException("Value cannot be less than "+minValue, 0);
  }
  return value;
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
public Object stringToValue(String text) throws ParseException {
 // RU locale (and others) requires a non-breaking space for a grouping separator
 text = text.replace(' ', '\u00a0');
 return super.stringToValue(text);
}

代码示例来源:origin: com.jgoodies/validation

/**
 * Returns the <code>Object</code> representation of the
 * <code>String</code> <code>text</code>.<p>
 *
 * Unlike its superclass, this class converts blank strings
 * to the empty value.
 *
 * @param text <code>String</code> to convert
 * @return <code>Object</code> representation of text
 * @throws ParseException if there is an error in the conversion
 */
@Override
public Object stringToValue(String text) throws ParseException {
  return ValidationUtils.isBlank(text)
    ? emptyValue
    : super.stringToValue(text);
}

代码示例来源:origin: org.zaproxy/zap

@Override
  public Object stringToValue(String text) throws ParseException {
    Object o = null;
    try {
      o = super.stringToValue(text);
    } catch (ParseException e) {
      boolean throwException = true;
      if (e.getMessage().equals("Value not within min/max range")) {
        final int value = ((Number)getFormat().parseObject(text)).intValue();
        if (value < minValue) {
          o = Integer.valueOf(minValue);
          throwException = false;
        } else if (value > maxValue) {
          o = Integer.valueOf(maxValue);
          throwException = false;
        }
      }
      if (throwException) {
        throw e;
      }
    }
    return o;
  }
}

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

retVal = super.stringToValue(text);

代码示例来源:origin: com.eas.platypus/platypus-js-forms

return super.stringToValue(aText);

代码示例来源:origin: org.softsmithy.lib/lib-core

value = (Number) super.stringToValue(getNumberFormat() != null ? getNumberFormat().format(value.toString()) : value.toString()); // needed?
value = (Number) super.stringToValue(text); // will throw a ParseException

代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing

value = (Number) super.stringToValue(getNumberFormat() != null ? getNumberFormat().format(value.toString()) : value.toString()); // needed?
value = (Number) super.stringToValue(text); // will throw a ParseException

相关文章