Package java.text

Examples of java.text.NumberFormat$NumberFormatGetter


   *
   * @param f The format.
   */
  public void setFormatter(final Format f)
  {
    final NumberFormat fm = (NumberFormat) f;
    super.setFormatter(fm);
  }
View Full Code Here


     * @param number the number to format
     * @return a currency formatted number string
     */
    public String currency(Number number) {
        if (number != null) {
            NumberFormat format = NumberFormat.getCurrencyInstance(getLocale());

            return format.format(number.doubleValue());

        } else {
            return getEmptyString();
        }
    }
View Full Code Here

     * @param number the number value to format
     * @return a percentage formatted number string
     */
    public String percentage(Number number) {
        if (number != null) {
            NumberFormat format = NumberFormat.getPercentInstance(getLocale());

            return format.format(number.doubleValue());

        } else {
            return getEmptyString();
        }
    }
View Full Code Here

                                              String semisphere) {
        double valueAbs = Math.abs(value);
        int degrees = (int) valueAbs;
        double minutes = (valueAbs - degrees) * 60.0;

        NumberFormat nf = NumberFormat.getInstance();
        nf.setGroupingUsed(false);
        nf.setMinimumIntegerDigits(integerDigits);
        nf.setMaximumIntegerDigits(integerDigits);
        String strDegrees = nf.format(degrees);
        nf.setMinimumIntegerDigits(2);
        nf.setMaximumIntegerDigits(2);
        nf.setMinimumFractionDigits(3);
        nf.setMaximumFractionDigits(3);
        String strMinutes = nf.format(minutes);
        return strDegrees + DEGREE_SIGN + strMinutes + "'" + semisphere;
    }
View Full Code Here

                                                 final Object value, final boolean isSelected,
                                                 final boolean hasFocus, final int row, final int column)
  {

    setFont(null);
    final NumberFormat nf = NumberFormat.getNumberInstance();
    if (value != null)
    {
      setText(nf.format(value));
    }
    else
    {
      setText("");
    }
View Full Code Here

    // Get it's eng format. Get it as string without trailing 0's
    final double outputValue = rounded / Math.pow(10, Math.floor(log10 / 3.0) * 3);
    final int outputValueDecimalPlaces = Math.max (1, computeLog10(outputValue));
   
    final Locale locale = context.getLocalizationContext().getLocale();
    final NumberFormat decimalFormat = createDecimalFormat(fixedSize, outputValueDecimalPlaces, precision, locale);
    final String result = decimalFormat.format(outputValue) + SUFFIXES[index];
    return new TypeValuePair(TextType.TYPE, result);
  }
View Full Code Here

  private NumberFormat createDecimalFormat(final boolean fixedSize,
                                           final int decimalPlaces,
                                           final int precision,
                                           final Locale locale)
  {
    final NumberFormat format = NumberFormat.getNumberInstance(locale);
    format.setGroupingUsed(false);
    if (fixedSize)
    {
      format.setMinimumFractionDigits(Math.max(0, precision - decimalPlaces - 1));
    }
    else
    {
      format.setMinimumFractionDigits(precision);
    }
    return format;
  }
View Full Code Here

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    @Override public String getCaption(Locale locale) {
        NumberFormat formatter = locale == null ? NumberFormat.getCurrencyInstance() : NumberFormat.getCurrencyInstance(locale);
        formatter.setCurrency(currency.getCurrency());
        return formatter.format(amount);
    }
View Full Code Here

     */

    public String getCurveInformation(double xmin, double xmax){
        try{
            computeStatistics(xmin, xmax);
            NumberFormat nf = NumberFormat.getInstance();
            nf.setMaximumFractionDigits(STATISTIC_ACCURACY);   

            String curveStat ="";

            if (SHOW_X_MIN){
                curveStat += "X min = " + nf.format(localRangeMinPoint.x+ "; ";
            }
            if (SHOW_X_MAX){
                curveStat += "X max = " + nf.format(localRangeMaxPoint.x+ "; ";
            }
            if (SHOW_Y_MIN){
                curveStat += "Y min = " + nf.format(localRangeMinPoint.y+ "; ";
            }
            if (SHOW_Y_MAX){
                curveStat += "Y max = " + nf.format(localRangeMaxPoint.y+ "; ";
            }
            if (SHOW_POINT_NUMBER){
                curveStat += "Nb pts = " + getLocalNbPoints()  + "; ";
            }
            if (SHOW_MEAN){
                curveStat += "Mean = " + nf.format(getLocalRangeMean()) + "; ";
            }
            if (SHOW_DEVIATION){
                curveStat += "Deviation = " + nf.format(getLocalDeviationValue()) + "; ";
            }
            if (SHOW_INTEGRAL){
                curveStat += "Integral = " + nf.format(getLocalIntegralValue())  + "; ";
            }

            return curveStat;

        }catch (DataException e){
View Full Code Here

   *
   * @param value Der Wert. (Zwischen 0 und 1)
   * @return Der Wert in Prozent.
   */
  public static String toPercentString(double value) {
    NumberFormat format = NumberFormat.getPercentInstance();
    format.setMinimumFractionDigits(2);
    format.setMaximumFractionDigits(2);
    return format.format(value);
  }
View Full Code Here

TOP

Related Classes of java.text.NumberFormat$NumberFormatGetter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.