Package org.jfree.chart.util
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field, NumberFormat.Style
-
Field Summary
Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
-
Constructor Summary
Constructors Constructor Description HMSNumberFormat()
Creates a new instance. -
Method Summary
Modifier and Type Method Description StringBuffer
format(double number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS.StringBuffer
format(long number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS.Number
parse(String source, ParsePosition parsePosition)
Parsing is not implemented, so this method always returnsnull
.Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Constructor Details
-
HMSNumberFormat
public HMSNumberFormat()Creates a new instance.
-
-
Method Details
-
format
Formats the specified number as a string of the form HH:MM:SS. The decimal fraction is ignored.- Specified by:
format
in classNumberFormat
- 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
Formats the specified number as a string of the form HH:MM:SS.- Specified by:
format
in classNumberFormat
- 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
Parsing is not implemented, so this method always returnsnull
.- Specified by:
parse
in classNumberFormat
- Parameters:
source
- ignored.parsePosition
- ignored.- Returns:
- Always
null
.
-