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

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

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

NumberFormatter.valueToString介绍

暂无

代码示例

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

@Override
public String valueToString(Object value) throws ParseException {
  return numberFormatter.valueToString(value);
}

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

@Override
  public String valueToString(Object aValue) throws ParseException {
    if (aValue == null) {
      return "";
    } else {
      if (aValue == DUMMY_MINUS) {
        return "-";
      } else {
        return super.valueToString(aValue);
      }
    }
  }
}

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

/**
 * Returns a String representation of the Object <code>value</code>.
 * This invokes <code>format</code> on the current <code>Format</code>.<p>
 *
 * Unlike its superclass, this class converts the empty value
 * to the empty string.
 *
 * @param value   the value to convert
 * @return a String representation of value
 * @throws ParseException if there is an error in the conversion
 */
@Override
public String valueToString(Object value) throws ParseException {
  return ValidationUtils.equals(value, emptyValue)
    ? ""
    : super.valueToString(value);
}

代码示例来源:origin: net.java.dev.jets3t/jets3t

if (byteSize > Math.pow(1024,3)) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,3))) + gigabyteSuffix;
} else if (byteSize > Math.pow(1024,2)) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,2))) + megabyteSuffix;
} else if (byteSize > 1024) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,1))) + kilobyteSuffix;
} else if (byteSize >= 0) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

if (byteSize > Math.pow(1024,3)) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,3))) + gigabyteSuffix;
} else if (byteSize > Math.pow(1024,2)) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,2))) + megabyteSuffix;
} else if (byteSize > 1024) {
  result = nf.valueToString(new Double(byteSize / Math.pow(1024,1))) + kilobyteSuffix;
} else if (byteSize >= 0) {

代码示例来源:origin: igvteam/igv

/**
 * Update the row filter regular expression from the expression in
 * the text box.
 */
private void updateFilter() {
  RowFilter<EncodeTableModel, Object> rf = null;
  //If current expression doesn't parse, don't update.
  try {
    rf = new RegexFilter(filterTextField.getText());
  } catch (java.util.regex.PatternSyntaxException e) {
    return;
  }
  model.getSorter().setRowFilter(rf);
  try {
    rowCountLabel.setText(numberFormatter.valueToString(table.getRowCount()) + " rows");
  } catch (ParseException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
  }
}

代码示例来源:origin: igvteam/igv

private void init(final EncodeTableModel model) {
  setModal(true);
  setTitle("Encode Production Data");
  table.setAutoCreateRowSorter(true);
  table.setModel(model);
  table.setRowSorter(model.getSorter());
  try {
    rowCountLabel.setText(numberFormatter.valueToString(table.getRowCount()) + " rows");
  } catch (ParseException e) {
  }
  table.setRowSelectionAllowed(false);
  table.setColumnSelectionAllowed(false);
  filterTextField.getDocument().addDocumentListener(
      new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
          updateFilter();
        }
        public void insertUpdate(DocumentEvent e) {
          updateFilter();
        }
        public void removeUpdate(DocumentEvent e) {
          updateFilter();
        }
      });
}

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

private NumberEditorNull(JSpinner spinner, DecimalFormat format) {
  super(spinner);
  if (!(spinner.getModel() instanceof SpinnerNumberModelNull)) {
    return;
  }
  
  SpinnerNumberModelNull model = (SpinnerNumberModelNull) spinner.getModel();
  NumberFormatter formatter = new NumberEditorFormatterNull(model, format);
  DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
  JFormattedTextField ftf = getTextField();
  ftf.setEditable(true);
  ftf.setFormatterFactory(factory);
  ftf.setHorizontalAlignment(JTextField.RIGHT);
  
  try {
    String maxString = formatter.valueToString(model.getMinimum());
    String minString = formatter.valueToString(model.getMaximum());
    ftf.setColumns(Math.max(maxString.length(), minString.length()));
  }
  catch (ParseException e) {
    // TBD should throw a chained error here
  }
}

代码示例来源:origin: dk.eobjects.datacleaner/DataCleaner-core

double highestValue = s.getMax();
MatrixValue[] matrixValues = mb.addColumn(
    _columns[i].getName(), nf.valueToString(highestValue),
    nf.valueToString(lowestValue), nf.valueToString(s
        .getSum()), nf.valueToString(s.getMean()), nf
        .valueToString(s.getGeometricMean()), nf
        .valueToString(s.getStandardDeviation()), nf
        .valueToString(s.getVariance()));

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

@Override
public String valueToString(Object value) throws ParseException {
  if (value == null) {
  getFormattedTextField().setBackground(Color.white);
    return "";
  }
  String retVal = null;
  try {
    retVal = super.valueToString(value);
    
  getFormattedTextField().setBackground(Color.white);
  }
  catch(ParseException ex){
    getFormattedTextField().setBackground(Color.red);
    throw ex;
  }
  
  return retVal; 
}

相关文章