Example usage for java.text DecimalFormat DecimalFormat

List of usage examples for java.text DecimalFormat DecimalFormat

Introduction

In this page you can find the example usage for java.text DecimalFormat DecimalFormat.

Prototype

public DecimalFormat() 

Source Link

Document

Creates a DecimalFormat using the default pattern and symbols for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:org.gaixie.micrite.jfreechart.style.BarStyle.java

/**
 * ???// w ww .  j a v a 2  s .c om
 * @param chart JFreeChart
 */
public static void styleOne(JFreeChart chart) {
    CategoryPlot categoryplot = (CategoryPlot) chart.getPlot();
    CategoryDataset dca = categoryplot.getDataset();
    //?
    chart.setBackgroundPaint(null);
    if (dca != null) {
        BarRenderer categoryitemrenderer = (BarRenderer) categoryplot.getRenderer();
        // ?
        categoryitemrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        //            categoryitemrenderer.setBaseItemLabelFont(
        //                    new Font("", Font.PLAIN, 15));
        categoryitemrenderer.setBaseItemLabelsVisible(true);
        //tooltip
        categoryplot.getRenderer()
                .setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{0}={2}", new DecimalFormat()));
        //?
        for (int i = 0; i < dca.getRowCount(); i++) {
            int colorIdx = i % colors.length;
            categoryitemrenderer.setSeriesPaint(i, colors[colorIdx]);
        }
    } else {
        //?
        categoryplot.setNoDataMessage("NO DATA");
    }
}

From source file:com.google.jenkins.flakyTestHandler.junit.FlakyCaseResult.java

private static float parseTime(Element testCase) {
    String time = testCase.attributeValue("time");
    if (time != null) {
        time = time.replace(",", "");
        try {/*from w  w  w  . j  ava 2 s  .  c o  m*/
            return Float.parseFloat(time);
        } catch (NumberFormatException e) {
            try {
                return new DecimalFormat().parse(time).floatValue();
            } catch (ParseException x) {
                // hmm, don't know what this format is.
            }
        }
    }
    return 0.0f;
}