Package java.text

Examples of java.text.DecimalFormat.toPattern()


  }

  private static void printPercentage(final Properties writer, Locale locale)
  {
    DecimalFormat sdf = (DecimalFormat) NumberFormat.getPercentInstance(locale);
    writer.put ("format.percentage", sdf.toPattern());
  }

  private static void printNumber(final Properties writer, Locale locale)
  {
    DecimalFormat sdf = (DecimalFormat) NumberFormat.getInstance(locale);
View Full Code Here


  }

  private static void printNumber(final Properties writer, Locale locale)
  {
    DecimalFormat sdf = (DecimalFormat) NumberFormat.getInstance(locale);
    writer.put ("format.number", sdf.toPattern());
  }

  private static void printDate(final Properties writer, int type, Locale locale)
  {
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getDateInstance(type, locale);
View Full Code Here

      throws ObjectFactoryException
  {
    super.setParameterFromObject(o);
    final DecimalFormat format = (DecimalFormat) o;
    //setParameter("localizedPattern", format.toLocalizedPattern());
    setParameter("pattern", format.toPattern());
  }

  /**
   * Creates an object (<code>DecimalFormat</code>) based on this description.
   *
 
View Full Code Here

      formatCombo.select(1);
    }else if (curr == null && type == DataType.DOUBLE){
      formatCombo.select(2);
    }else if (curr != null){
      formatCombo.select(3);
      txtCustom.setText(curr.toPattern());
    }
    comboSelected();
   
    //add controls to composite as necessary
     return composite;
View Full Code Here

    // There aren't really many tests we can do, since it doesn't
    // seem like any canonical output format is documented.

    DecimalFormat df = new DecimalFormat("0.##");
    harness.check(df.toPattern(), "#0.##");
    harness.check(df.toLocalizedPattern(), "#0.##");

    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
    dfs.setDecimalSeparator(',');
    dfs.setZeroDigit('1');
View Full Code Here

    // symbols so pass symbols back to df
    harness.check(df.toLocalizedPattern(), "X1,XX");

    df.applyPattern("Fr #,##0.##");
   
    String x1 = df.toPattern();
    String x2 = df.toLocalizedPattern();
    harness.check(x1.length(), x2.length());
   
    boolean ok = x1.length() == x2.length();
    for (int i = 0; i < x1.length(); ++i)
View Full Code Here

  }

  public void test2(TestHarness harness)
  {
    DecimalFormat f1 = new DecimalFormat("#0.00;(#0.00)");
    harness.check(f1.toPattern(), "#0.00;(#0.00)");

    DecimalFormat f2 =
      new DecimalFormat("'#'1'.' ''nessuno ci capisce niente qui #0.00;(#0.00)");
    harness.check(f2.toPattern(),
                  "'#1. '''nessuno ci capisce niente qui #0.00;(#0.00)");
View Full Code Here

    DecimalFormat f1 = new DecimalFormat("#0.00;(#0.00)");
    harness.check(f1.toPattern(), "#0.00;(#0.00)");

    DecimalFormat f2 =
      new DecimalFormat("'#'1'.' ''nessuno ci capisce niente qui #0.00;(#0.00)");
    harness.check(f2.toPattern(),
                  "'#1. '''nessuno ci capisce niente qui #0.00;(#0.00)");
  }
 
  public void test3(TestHarness harness)
  {
View Full Code Here

  }
 
  public void test3(TestHarness harness)
  {
    DecimalFormat f1 = new DecimalFormat("0.00");
    harness.check(f1.toPattern(), "#0.00");
   
    f1.setMinimumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    f1.setMaximumIntegerDigits(0);
View Full Code Here

  {
    DecimalFormat f1 = new DecimalFormat("0.00");
    harness.check(f1.toPattern(), "#0.00");
   
    f1.setMinimumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    f1.setMaximumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    DecimalFormat f2 = new DecimalFormat("#0.#E0");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.