Class HMSNumberFormat

java.lang.Object
java.text.Format
java.text.NumberFormat
org.jfree.chart.util.HMSNumberFormat
All Implemented Interfaces:
Serializable, Cloneable

public class HMSNumberFormat
extends NumberFormat
A custom number formatter that formats numbers (in seconds) as HH:MM:SS. Created in response to: http://stackoverflow.com/questions/19028908/jfreechart-need-to-customize-y-axis-just-for-printing
See Also:
Serialized Form
  • Constructor Details

  • Method Details

    • format

      public StringBuffer format​(double number, StringBuffer toAppendTo, FieldPosition pos)
      Formats the specified number as a string of the form HH:MM:SS. The decimal fraction is ignored.
      Specified by:
      format in class NumberFormat
      Parameters:
      number - the number to format.
      toAppendTo - the buffer to append to (ignored here).
      pos - the field position (ignored here).
      Returns:
      The string buffer.
    • format

      public StringBuffer format​(long number, StringBuffer toAppendTo, FieldPosition pos)
      Formats the specified number as a string of the form HH:MM:SS.
      Specified by:
      format in class NumberFormat
      Parameters:
      number - the number to format.
      toAppendTo - the buffer to append to (ignored here).
      pos - the field position (ignored here).
      Returns:
      The string buffer.
    • parse

      public Number parse​(String source, ParsePosition parsePosition)
      Parsing is not implemented, so this method always returns null.
      Specified by:
      parse in class NumberFormat
      Parameters:
      source - ignored.
      parsePosition - ignored.
      Returns:
      Always null.