Package org.jfree.chart.axis
Class MonthDateFormat
- java.lang.Object
-
- java.text.Format
-
- java.text.DateFormat
-
- org.jfree.chart.axis.MonthDateFormat
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class MonthDateFormat extends java.text.DateFormat
A formatter that formats dates to show the initial letter(s) of the month name and, as an option, the year for the first or last month of each year.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]
months
The symbols used for the months.private boolean[]
showYear
Flags that control which months will have the year appended.private java.text.DateFormat
yearFormatter
The year formatter.-
Fields inherited from class java.text.DateFormat
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
-
-
Constructor Summary
Constructors Constructor Description MonthDateFormat()
Creates a new instance for the default time zone.MonthDateFormat(java.util.Locale locale)
Creates a new instance for the specified time zone.MonthDateFormat(java.util.Locale locale, int chars)
Creates a new instance for the specified time zone.MonthDateFormat(java.util.TimeZone zone)
Creates a new instance for the specified time zone.MonthDateFormat(java.util.TimeZone zone, int chars)
Creates a new instance for the specified time zone.MonthDateFormat(java.util.TimeZone zone, java.util.Locale locale, int chars, boolean[] showYear, java.text.DateFormat yearFormatter)
Creates a new formatter.MonthDateFormat(java.util.TimeZone zone, java.util.Locale locale, int chars, boolean showYearForJan, boolean showYearForDec)
Creates a new formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Tests this formatter for equality with an arbitrary object.java.lang.StringBuffer
format(java.util.Date date, java.lang.StringBuffer toAppendTo, java.text.FieldPosition fieldPosition)
Formats the given date.java.util.Date
parse(java.lang.String source, java.text.ParsePosition pos)
Parses the given string (not implemented).-
Methods inherited from class java.text.DateFormat
clone, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
-
-
-
-
Constructor Detail
-
MonthDateFormat
public MonthDateFormat()
Creates a new instance for the default time zone.
-
MonthDateFormat
public MonthDateFormat(java.util.TimeZone zone)
Creates a new instance for the specified time zone.- Parameters:
zone
- the time zone (null
not permitted).
-
MonthDateFormat
public MonthDateFormat(java.util.Locale locale)
Creates a new instance for the specified time zone.- Parameters:
locale
- the locale used to obtain the month names (null
not permitted).
-
MonthDateFormat
public MonthDateFormat(java.util.TimeZone zone, int chars)
Creates a new instance for the specified time zone.- Parameters:
zone
- the time zone (null
not permitted).chars
- the maximum number of characters to use from the month names (that are obtained from the date symbols of the default locale). If this value is <= 0, the entire month name is used in each case.
-
MonthDateFormat
public MonthDateFormat(java.util.Locale locale, int chars)
Creates a new instance for the specified time zone.- Parameters:
locale
- the locale (null
not permitted).chars
- the maximum number of characters to use from the month names (that are obtained from the date symbols of the default locale). If this value is <= 0, the entire month name is used in each case.
-
MonthDateFormat
public MonthDateFormat(java.util.TimeZone zone, java.util.Locale locale, int chars, boolean showYearForJan, boolean showYearForDec)
Creates a new formatter.- Parameters:
zone
- the time zone used to extract the month and year from dates passed to this formatter (null
not permitted).locale
- the locale used to determine the month names (null
not permitted).chars
- the maximum number of characters to use from the month names, or zero to indicate that the entire month name should be used.showYearForJan
- a flag that controls whether or not the year is appended to the symbol for the first month of each year.showYearForDec
- a flag that controls whether or not the year is appended to the symbol for the last month of each year.
-
MonthDateFormat
public MonthDateFormat(java.util.TimeZone zone, java.util.Locale locale, int chars, boolean[] showYear, java.text.DateFormat yearFormatter)
Creates a new formatter.- Parameters:
zone
- the time zone used to extract the month and year from dates passed to this formatter (null
not permitted).locale
- the locale used to determine the month names (null
not permitted).chars
- the maximum number of characters to use from the month names, or zero to indicate that the entire month name should be used.showYear
- an array of flags that control whether or not the year is displayed for a particular month.yearFormatter
- the year formatter.
-
-
Method Detail
-
format
public java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer toAppendTo, java.text.FieldPosition fieldPosition)
Formats the given date.- Specified by:
format
in classjava.text.DateFormat
- Parameters:
date
- the date.toAppendTo
- the string buffer.fieldPosition
- the field position.- Returns:
- The formatted date.
-
parse
public java.util.Date parse(java.lang.String source, java.text.ParsePosition pos)
Parses the given string (not implemented).- Specified by:
parse
in classjava.text.DateFormat
- Parameters:
source
- the date string.pos
- the parse position.- Returns:
null
, as this method has not been implemented.
-
equals
public boolean equals(java.lang.Object obj)
Tests this formatter for equality with an arbitrary object.- Overrides:
equals
in classjava.text.DateFormat
- Parameters:
obj
- the object.- Returns:
- A boolean.
-
-