Package org.jfree.chart.util
Class HMSNumberFormat
- java.lang.Object
-
- java.text.Format
-
- java.text.NumberFormat
-
- org.jfree.chart.util.HMSNumberFormat
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class HMSNumberFormat extends java.text.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.text.NumberFormat
formatter
-
Constructor Summary
Constructors Constructor Description HMSNumberFormat()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuffer
format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS.java.lang.StringBuffer
format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS.java.lang.Number
parse(java.lang.String source, java.text.ParsePosition parsePosition)
Parsing is not implemented, so this method always returnsnull
.-
Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, 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
-
-
-
-
Method Detail
-
format
public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS. The decimal fraction is ignored.- Specified by:
format
in classjava.text.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 java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
Formats the specified number as a string of the form HH:MM:SS.- Specified by:
format
in classjava.text.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 java.lang.Number parse(java.lang.String source, java.text.ParsePosition parsePosition)
Parsing is not implemented, so this method always returnsnull
.- Specified by:
parse
in classjava.text.NumberFormat
- Parameters:
source
- ignored.parsePosition
- ignored.- Returns:
- Always
null
.
-
-